summaryrefslogtreecommitdiff
path: root/libswscale/swscale_internal.h
diff options
context:
space:
mode:
authorMark Reid <mindmark@gmail.com>2020-05-03 16:10:04 -0700
committerMichael Niedermayer <michael@niedermayer.cc>2020-05-05 20:06:58 +0200
commitb4967fc71c63eae8cd96f9c46cd3e1fbd705bbf9 (patch)
tree3596a2ed253605b9f3f29a7b66dcc755a0c7b482 /libswscale/swscale_internal.h
parentba5d0515a6dc0e34d578e5ef94b6ca5f17fc979d (diff)
libswscale: add output support for AV_PIX_FMT_GBRAPF32
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libswscale/swscale_internal.h')
-rw-r--r--libswscale/swscale_internal.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 9dda53eead..ee46092ff6 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -647,6 +647,13 @@ static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
return desc->comp[0].depth == 16;
}
+static av_always_inline int is32BPS(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
+ return desc->comp[0].depth == 32;
+}
+
static av_always_inline int isNBPS(enum AVPixelFormat pix_fmt)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
@@ -918,8 +925,37 @@ static inline void fillPlane16(uint8_t *plane, int stride, int width, int height
}
ptr += stride;
}
+#undef FILL
}
+static inline void fillPlane32(uint8_t *plane, int stride, int width, int height, int y,
+ int alpha, int bits, const int big_endian, int is_float)
+{
+ int i, j;
+ uint8_t *ptr = plane + stride * y;
+ uint32_t v;
+ uint32_t onef32 = 0x3f800000;
+ if (is_float)
+ v = alpha ? onef32 : 0;
+ else
+ v = alpha ? 0xFFFFFFFF>>(32-bits) : (1<<(bits-1));
+
+ for (i = 0; i < height; i++) {
+#define FILL(wfunc) \
+ for (j = 0; j < width; j++) {\
+ wfunc(ptr+4*j, v);\
+ }
+ if (big_endian) {
+ FILL(AV_WB32);
+ } else {
+ FILL(AV_WL32);
+ }
+ ptr += stride;
+ }
+#undef FILL
+}
+
+
#define MAX_SLICE_PLANES 4
/// Slice plane