}
}
+static void yuv2p016cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterSize,
+ const int16_t **chrUSrc, const int16_t **chrVSrc,
+ uint8_t *dest8, int chrDstW)
+{
+ uint16_t *dest = (uint16_t*)dest8;
+ const int32_t **uSrc = (const int32_t **)chrUSrc;
+ const int32_t **vSrc = (const int32_t **)chrVSrc;
+ int shift = 15;
+ int big_endian = c->dstFormat == AV_PIX_FMT_P016BE;
+ int i, j;
+
+ for (i = 0; i < chrDstW; i++) {
+ int u = 1 << (shift - 1);
+ int v = 1 << (shift - 1);
+
+ /* See yuv2planeX_16_c_template for details. */
+ u -= 0x40000000;
+ v -= 0x40000000;
+ for (j = 0; j < chrFilterSize; j++) {
+ u += uSrc[j][i] * (unsigned)chrFilter[j];
+ v += vSrc[j][i] * (unsigned)chrFilter[j];
+ }
+
+ output_pixel(&dest[2*i] , u, 0x8000, int);
+ output_pixel(&dest[2*i+1], v, 0x8000, int);
+ }
+}
+
+static av_always_inline void
+yuv2plane1_float_c_template(const int32_t *src, float *dest, int dstW)
+{
+ static const int big_endian = HAVE_BIGENDIAN;
+ static const int shift = 3;
+ static const float float_mult = 1.0f / 65535.0f;
+ int i, val;
+ uint16_t val_uint;
+
+ for (i = 0; i < dstW; ++i){
+ val = src[i] + (1 << (shift - 1));
+ output_pixel(&val_uint, val, 0, uint);
+ dest[i] = float_mult * (float)val_uint;
+ }
+}
+
+static av_always_inline void
+yuv2plane1_float_bswap_c_template(const int32_t *src, uint32_t *dest, int dstW)
+{
+ static const int big_endian = HAVE_BIGENDIAN;
+ static const int shift = 3;
+ static const float float_mult = 1.0f / 65535.0f;
+ int i, val;
+ uint16_t val_uint;
+
+ for (i = 0; i < dstW; ++i){
+ val = src[i] + (1 << (shift - 1));
+ output_pixel(&val_uint, val, 0, uint);
+ dest[i] = av_bswap32(av_float2int(float_mult * (float)val_uint));
+ }
+}
+
+static av_always_inline void
+yuv2planeX_float_c_template(const int16_t *filter, int filterSize, const int32_t **src,
+ float *dest, int dstW)
+{
+ static const int big_endian = HAVE_BIGENDIAN;
+ static const int shift = 15;
+ static const float float_mult = 1.0f / 65535.0f;
+ int i, j, val;
+ uint16_t val_uint;
+
+ for (i = 0; i < dstW; ++i){
+ val = (1 << (shift - 1)) - 0x40000000;
+ for (j = 0; j < filterSize; ++j){
+ val += src[j][i] * (unsigned)filter[j];
+ }
+ output_pixel(&val_uint, val, 0x8000, int);
+ dest[i] = float_mult * (float)val_uint;
+ }
+}
+
+static av_always_inline void
+yuv2planeX_float_bswap_c_template(const int16_t *filter, int filterSize, const int32_t **src,
+ uint32_t *dest, int dstW)
+{
+ static const int big_endian = HAVE_BIGENDIAN;
+ static const int shift = 15;
+ static const float float_mult = 1.0f / 65535.0f;
+ int i, j, val;
+ uint16_t val_uint;
+
+ for (i = 0; i < dstW; ++i){
+ val = (1 << (shift - 1)) - 0x40000000;
+ for (j = 0; j < filterSize; ++j){
+ val += src[j][i] * (unsigned)filter[j];
+ }
+ output_pixel(&val_uint, val, 0x8000, int);
+ dest[i] = av_bswap32(av_float2int(float_mult * (float)val_uint));
+ }
+}
+
+#define yuv2plane1_float(template, dest_type, BE_LE) \
+static void yuv2plane1_float ## BE_LE ## _c(const int16_t *src, uint8_t *dest, int dstW, \
+ const uint8_t *dither, int offset) \
+{ \
+ template((const int32_t *)src, (dest_type *)dest, dstW); \
+}
+
+#define yuv2planeX_float(template, dest_type, BE_LE) \
+static void yuv2planeX_float ## BE_LE ## _c(const int16_t *filter, int filterSize, \
+ const int16_t **src, uint8_t *dest, int dstW, \
+ const uint8_t *dither, int offset) \
+{ \
+ template(filter, filterSize, (const int32_t **)src, (dest_type *)dest, dstW); \
+}
+
+#if HAVE_BIGENDIAN
+yuv2plane1_float(yuv2plane1_float_c_template, float, BE)
+yuv2plane1_float(yuv2plane1_float_bswap_c_template, uint32_t, LE)
+yuv2planeX_float(yuv2planeX_float_c_template, float, BE)
+yuv2planeX_float(yuv2planeX_float_bswap_c_template, uint32_t, LE)
+#else
+yuv2plane1_float(yuv2plane1_float_c_template, float, LE)
+yuv2plane1_float(yuv2plane1_float_bswap_c_template, uint32_t, BE)
+yuv2planeX_float(yuv2planeX_float_c_template, float, LE)
+yuv2planeX_float(yuv2planeX_float_bswap_c_template, uint32_t, BE)
+#endif
+
#undef output_pixel
#define output_pixel(pos, val) \
} else if (is16BPS(dstFormat)) {
*yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c;
*yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c;
+ if (dstFormat == AV_PIX_FMT_P016LE || dstFormat == AV_PIX_FMT_P016BE) {
+ *yuv2nv12cX = yuv2p016cX_c;
+ }
} else if (isNBPS(dstFormat)) {
if (desc->comp[0].depth == 9) {
*yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c;
*yuv2plane1 = isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c;
} else
av_assert0(0);
+ } else if (dstFormat == AV_PIX_FMT_GRAYF32BE) {
+ *yuv2planeX = yuv2planeX_floatBE_c;
+ *yuv2plane1 = yuv2plane1_floatBE_c;
+ } else if (dstFormat == AV_PIX_FMT_GRAYF32LE) {
+ *yuv2planeX = yuv2planeX_floatLE_c;
+ *yuv2plane1 = yuv2plane1_floatLE_c;
} else {
*yuv2plane1 = yuv2plane1_8_c;
*yuv2planeX = yuv2planeX_8_c;