summaryrefslogtreecommitdiff
path: root/libswscale
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-30 17:41:17 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-10-30 17:47:36 +0100
commita201639a01284003a055f195f4e850a0cf3fc2d5 (patch)
tree959d66dc788f6d76941e646bbb49dea93209b231 /libswscale
parent788afee86e283535f37fdcb649b2f180ad305f75 (diff)
parent7658295ba353b8bedb3af904f46cfb1ba0cea86a (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: pixfmt: support more yuva formats swscale: support gray to 9bit and 10bit formats configure: rewrite print_config() function using awk FATE: fix (AD)PCM test dependencies broken in e519990 Use ptrdiff_t instead of int for intra pred "stride" function parameter. x86: use PRED4x4/8x8/8x8L/16x16 macros to declare intrapred prototypes. Conflicts: libavcodec/h264pred.c libavcodec/h264pred_template.c libavutil/pixfmt.h libswscale/swscale_unscaled.c tests/ref/lavfi/pixdesc tests/ref/lavfi/pixfmts_copy tests/ref/lavfi/pixfmts_null tests/ref/lavfi/pixfmts_scale tests/ref/lavfi/pixfmts_vflip Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/input.c40
-rw-r--r--libswscale/swscale.c38
-rw-r--r--libswscale/swscale_unscaled.c42
-rw-r--r--libswscale/utils.c18
4 files changed, 133 insertions, 5 deletions
diff --git a/libswscale/input.c b/libswscale/input.c
index 6d76068f9a..d10b4f1062 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -935,6 +935,16 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_YUV420P14LE:
case AV_PIX_FMT_YUV420P16LE:
case AV_PIX_FMT_YUV422P16LE:
+
+ case AV_PIX_FMT_YUVA444P9LE:
+ case AV_PIX_FMT_YUVA422P9LE:
+ case AV_PIX_FMT_YUVA420P9LE:
+ case AV_PIX_FMT_YUVA444P10LE:
+ case AV_PIX_FMT_YUVA422P10LE:
+ case AV_PIX_FMT_YUVA420P10LE:
+ case AV_PIX_FMT_YUVA420P16LE:
+ case AV_PIX_FMT_YUVA422P16LE:
+ case AV_PIX_FMT_YUVA444P16LE:
case AV_PIX_FMT_YUV444P16LE:
c->chrToYV12 = bswap16UV_c;
break;
@@ -954,6 +964,16 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_YUV420P16BE:
case AV_PIX_FMT_YUV422P16BE:
case AV_PIX_FMT_YUV444P16BE:
+
+ case AV_PIX_FMT_YUVA444P9BE:
+ case AV_PIX_FMT_YUVA422P9BE:
+ case AV_PIX_FMT_YUVA420P9BE:
+ case AV_PIX_FMT_YUVA444P10BE:
+ case AV_PIX_FMT_YUVA422P10BE:
+ case AV_PIX_FMT_YUVA420P10BE:
+ case AV_PIX_FMT_YUVA420P16BE:
+ case AV_PIX_FMT_YUVA422P16BE:
+ case AV_PIX_FMT_YUVA444P16BE:
c->chrToYV12 = bswap16UV_c;
break;
#endif
@@ -1165,6 +1185,16 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_YUV420P16LE:
case AV_PIX_FMT_YUV422P16LE:
case AV_PIX_FMT_YUV444P16LE:
+
+ case AV_PIX_FMT_YUVA444P9LE:
+ case AV_PIX_FMT_YUVA422P9LE:
+ case AV_PIX_FMT_YUVA420P9LE:
+ case AV_PIX_FMT_YUVA444P10LE:
+ case AV_PIX_FMT_YUVA422P10LE:
+ case AV_PIX_FMT_YUVA420P10LE:
+ case AV_PIX_FMT_YUVA420P16LE:
+ case AV_PIX_FMT_YUVA422P16LE:
+ case AV_PIX_FMT_YUVA444P16LE:
case AV_PIX_FMT_GRAY16LE:
c->lumToYV12 = bswap16Y_c;
break;
@@ -1184,6 +1214,16 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
case AV_PIX_FMT_YUV420P16BE:
case AV_PIX_FMT_YUV422P16BE:
case AV_PIX_FMT_YUV444P16BE:
+
+ case AV_PIX_FMT_YUVA444P9BE:
+ case AV_PIX_FMT_YUVA422P9BE:
+ case AV_PIX_FMT_YUVA420P9BE:
+ case AV_PIX_FMT_YUVA444P10BE:
+ case AV_PIX_FMT_YUVA422P10BE:
+ case AV_PIX_FMT_YUVA420P10BE:
+ case AV_PIX_FMT_YUVA420P16BE:
+ case AV_PIX_FMT_YUVA422P16BE:
+ case AV_PIX_FMT_YUVA444P16BE:
case AV_PIX_FMT_GRAY16BE:
c->lumToYV12 = bswap16Y_c;
break;
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 37b7712e22..71fb9899c4 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -62,6 +62,28 @@ static av_always_inline void fillPlane(uint8_t *plane, int stride, int width,
}
}
+static void fill_plane9or10(uint8_t *plane, int stride, int width,
+ int height, int y, uint8_t val,
+ const int dst_depth, const int big_endian)
+{
+ int i, j;
+ uint16_t *dst = (uint16_t *) (plane + stride * y);
+#define FILL8TO9_OR_10(wfunc) \
+ for (i = 0; i < height; i++) { \
+ for (j = 0; j < width; j++) { \
+ wfunc(&dst[j], (val << (dst_depth - 8)) | \
+ (val >> (16 - dst_depth))); \
+ } \
+ dst += stride / 2; \
+ }
+ if (big_endian) {
+ FILL8TO9_OR_10(AV_WB16);
+ } else {
+ FILL8TO9_OR_10(AV_WL16);
+ }
+}
+
+
static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW,
const uint8_t *_src, const int16_t *filter,
const int32_t *filterPos, int filterSize)
@@ -660,8 +682,20 @@ static int swScale(SwsContext *c, const uint8_t *src[],
}
}
- if (isPlanar(dstFormat) && isALPHA(dstFormat) && !alpPixBuf)
- fillPlane(dst[3], dstStride[3], dstW, dstY - lastDstY, lastDstY, 255);
+ if (isPlanar(dstFormat) && isALPHA(dstFormat) && !alpPixBuf) {
+ int length = dstW;
+ int height = dstY - lastDstY;
+ if (is16BPS(c->dstFormat))
+ length *= 2;
+
+ if (is9_OR_10BPS(dstFormat)) {
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat);
+ fill_plane9or10(dst[3], dstStride[3], length, height, lastDstY,
+ 255, desc->comp[3].depth_minus1 + 1,
+ isBE(dstFormat));
+ } else
+ fillPlane(dst[3], dstStride[3], length, height, lastDstY, 255);
+ }
#if HAVE_MMXEXT_INLINE
if (av_get_cpu_flags() & AV_CPU_FLAG_MMXEXT)
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 0fe974f054..08cc2ed146 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -140,11 +140,11 @@ static void fillPlane(uint8_t *plane, int stride, int width, int height, int y,
}
static void fillPlane16(uint8_t *plane, int stride, int width, int height, int y,
- int alpha, int bits)
+ int alpha, int bits, const int big_endian)
{
int i, j;
uint8_t *ptr = plane + stride * y;
- int v = alpha ? -1 : (1<<bits);
+ int v = alpha ? 0xFFFF>>(15-bits) : (1<<bits);
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
AV_WN16(ptr+2*j, v);
@@ -153,6 +153,27 @@ static void fillPlane16(uint8_t *plane, int stride, int width, int height, int y
}
}
+static void fill_plane9or10(uint8_t *plane, int stride, int width,
+ int height, int y, uint8_t val,
+ const int dst_depth, const int big_endian)
+{
+ int i, j;
+ uint16_t *dst = (uint16_t *) (plane + stride * y);
+#define FILL8TO9_OR_10(wfunc) \
+ for (i = 0; i < height; i++) { \
+ for (j = 0; j < width; j++) { \
+ wfunc(&dst[j], (val << (dst_depth - 8)) | \
+ (val >> (16 - dst_depth))); \
+ } \
+ dst += stride / 2; \
+ }
+ if (big_endian) {
+ FILL8TO9_OR_10(AV_WB16);
+ } else {
+ FILL8TO9_OR_10(AV_WL16);
+ }
+}
+
static void copyPlane(const uint8_t *src, int srcStride,
int srcSliceY, int srcSliceH, int width,
uint8_t *dst, int dstStride)
@@ -780,13 +801,28 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
// ignore palette for GRAY8
if (plane == 1 && !dst[2]) continue;
if (!src[plane] || (plane == 1 && !src[2])) {
+#if 1
if (is16BPS(c->dstFormat) || isNBPS(c->dstFormat)) {
fillPlane16(dst[plane], dstStride[plane], length, height, y,
- plane == 3, desc_dst->comp[plane].depth_minus1);
+ plane == 3, desc_dst->comp[plane].depth_minus1,
+ isBE(c->dstFormat));
} else {
fillPlane(dst[plane], dstStride[plane], length, height, y,
(plane == 3) ? 255 : 128);
}
+#else
+ int val = (plane == 3) ? 255 : 128;
+ if (is16BPS(c->dstFormat))
+ length *= 2;
+ if (is9_OR_10BPS(c->dstFormat)) {
+ fill_plane9or10(dst[plane], dstStride[plane],
+ length, height, y, val,
+ desc_dst->comp[plane].depth_minus1 + 1,
+ isBE(c->dstFormat));
+ } else
+ fillPlane(dst[plane], dstStride[plane], length, height, y,
+ val);
+#endif
} else {
if(isNBPS(c->srcFormat) || isNBPS(c->dstFormat)
|| (is16BPS(c->srcFormat) != is16BPS(c->dstFormat))
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 21fd718e4c..9ee4e824d1 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -116,6 +116,24 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
[AV_PIX_FMT_YUVA420P] = { 1, 1 },
[AV_PIX_FMT_YUVA422P] = { 1, 1 },
[AV_PIX_FMT_YUVA444P] = { 1, 1 },
+ [AV_PIX_FMT_YUVA420P9BE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA420P9LE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA422P9BE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA422P9LE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA444P9BE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA444P9LE] = { 1, 1 },
+ [AV_PIX_FMT_YUVA420P10BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA420P10LE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA422P10BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA422P10LE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA444P10BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA444P10LE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA420P16BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA420P16LE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA422P16BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA422P16LE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA444P16BE]= { 1, 1 },
+ [AV_PIX_FMT_YUVA444P16LE]= { 1, 1 },
[AV_PIX_FMT_RGB48BE] = { 1, 1 },
[AV_PIX_FMT_RGB48LE] = { 1, 1 },
[AV_PIX_FMT_RGBA64BE] = { 1, 0 },