#include "config.h"
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-
#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
#include "libavutil/common.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/ppc/util_altivec.h"
#define STR(s) AV_TOSTRING(s) // AV_STRINGIFY is too long
* Write one line of horizontally scaled data to planar output
* without any additional vertical scaling (or point-scaling).
*
- * @param src scaled source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param dest pointer to the output plane. For >8bit
+ * @param src scaled source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param dest pointer to the output plane. For >8-bit
* output, this is in uint16_t
* @param dstW width of destination in pixels
* @param dither ordered dither array of type int16_t and size 8
* Write one line of horizontally scaled data to planar output
* with multi-point vertical scaling between input pixels.
*
- * @param filter vertical luma/alpha scaling coefficients, 12bit [0,4096]
- * @param src scaled luma (Y) or alpha (A) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
+ * @param filter vertical luma/alpha scaling coefficients, 12 bits [0,4096]
+ * @param src scaled luma (Y) or alpha (A) source data, 15 bits for
+ * 8-10-bit output, 19 bits for 16-bit output (in int32_t)
* @param filterSize number of vertical input lines to scale
- * @param dest pointer to output plane. For >8bit
+ * @param dest pointer to output plane. For >8-bit
* output, this is in uint16_t
* @param dstW width of destination pixels
* @param offset Dither offset
* with multi-point vertical scaling between input pixels.
*
* @param c SWS scaling context
- * @param chrFilter vertical chroma scaling coefficients, 12bit [0,4096]
- * @param chrUSrc scaled chroma (U) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param chrVSrc scaled chroma (V) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
+ * @param chrFilter vertical chroma scaling coefficients, 12 bits [0,4096]
+ * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit
+ * output, 19 bits for 16-bit output (in int32_t)
+ * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit
+ * output, 19 bits for 16-bit output (in int32_t)
* @param chrFilterSize number of vertical chroma input lines to scale
- * @param dest pointer to the output plane. For >8bit
+ * @param dest pointer to the output plane. For >8-bit
* output, this is in uint16_t
* @param dstW width of chroma planes
*/
* that this function may do chroma scaling, see the "uvalpha" argument.
*
* @param c SWS scaling context
- * @param lumSrc scaled luma (Y) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param chrUSrc scaled chroma (U) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param chrVSrc scaled chroma (V) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param alpSrc scaled alpha (A) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param dest pointer to the output plane. For 16bit output, this is
+ * @param lumSrc scaled luma (Y) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param alpSrc scaled alpha (A) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param dest pointer to the output plane. For 16-bit output, this is
* uint16_t
* @param dstW width of lumSrc and alpSrc in pixels, number of pixels
* to write into dest[]
* output by doing bilinear scaling between two input lines.
*
* @param c SWS scaling context
- * @param lumSrc scaled luma (Y) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param chrUSrc scaled chroma (U) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param chrVSrc scaled chroma (V) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param alpSrc scaled alpha (A) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param dest pointer to the output plane. For 16bit output, this is
+ * @param lumSrc scaled luma (Y) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param alpSrc scaled alpha (A) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param dest pointer to the output plane. For 16-bit output, this is
* uint16_t
* @param dstW width of lumSrc and alpSrc in pixels, number of pixels
* to write into dest[]
* output by doing multi-point vertical scaling between input pixels.
*
* @param c SWS scaling context
- * @param lumFilter vertical luma/alpha scaling coefficients, 12bit [0,4096]
- * @param lumSrc scaled luma (Y) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
+ * @param lumFilter vertical luma/alpha scaling coefficients, 12 bits [0,4096]
+ * @param lumSrc scaled luma (Y) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
* @param lumFilterSize number of vertical luma/alpha input lines to scale
- * @param chrFilter vertical chroma scaling coefficients, 12bit [0,4096]
- * @param chrUSrc scaled chroma (U) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param chrVSrc scaled chroma (V) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
+ * @param chrFilter vertical chroma scaling coefficients, 12 bits [0,4096]
+ * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
* @param chrFilterSize number of vertical chroma input lines to scale
- * @param alpSrc scaled alpha (A) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param dest pointer to the output plane. For 16bit output, this is
+ * @param alpSrc scaled alpha (A) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param dest pointer to the output plane. For 16-bit output, this is
* uint16_t
* @param dstW width of lumSrc and alpSrc in pixels, number of pixels
* to write into dest[]
* output by doing multi-point vertical scaling between input pixels.
*
* @param c SWS scaling context
- * @param lumFilter vertical luma/alpha scaling coefficients, 12bit [0,4096]
- * @param lumSrc scaled luma (Y) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
+ * @param lumFilter vertical luma/alpha scaling coefficients, 12 bits [0,4096]
+ * @param lumSrc scaled luma (Y) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
* @param lumFilterSize number of vertical luma/alpha input lines to scale
- * @param chrFilter vertical chroma scaling coefficients, 12bit [0,4096]
- * @param chrUSrc scaled chroma (U) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param chrVSrc scaled chroma (V) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
+ * @param chrFilter vertical chroma scaling coefficients, 12 bits [0,4096]
+ * @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param chrVSrc scaled chroma (V) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
* @param chrFilterSize number of vertical chroma input lines to scale
- * @param alpSrc scaled alpha (A) source data, 15bit for 8-10bit output,
- * 19-bit for 16bit output (in int32_t)
- * @param dest pointer to the output planes. For 16bit output, this is
+ * @param alpSrc scaled alpha (A) source data, 15 bits for 8-10-bit output,
+ * 19 bits for 16-bit output (in int32_t)
+ * @param dest pointer to the output planes. For 16-bit output, this is
* uint16_t
* @param dstW width of lumSrc and alpSrc in pixels, number of pixels
* to write into dest[]
* Note that src, dst, srcStride, dstStride will be copied in the
* sws_scale() wrapper so they can be freely modified here.
*/
- SwsFunc swScale;
+ SwsFunc swscale;
int srcW; ///< Width of source luma/alpha planes.
int srcH; ///< Height of source luma/alpha planes.
int dstH; ///< Height of destination luma/alpha planes.
vector signed short *vYCoeffsBank, *vCCoeffsBank;
#endif
-#if ARCH_BFIN
- DECLARE_ALIGNED(4, uint32_t, oy);
- DECLARE_ALIGNED(4, uint32_t, oc);
- DECLARE_ALIGNED(4, uint32_t, zero);
- DECLARE_ALIGNED(4, uint32_t, cy);
- DECLARE_ALIGNED(4, uint32_t, crv);
- DECLARE_ALIGNED(4, uint32_t, rmask);
- DECLARE_ALIGNED(4, uint32_t, cbu);
- DECLARE_ALIGNED(4, uint32_t, bmask);
- DECLARE_ALIGNED(4, uint32_t, cgu);
- DECLARE_ALIGNED(4, uint32_t, cgv);
- DECLARE_ALIGNED(4, uint32_t, gmask);
-#endif
-
-#if HAVE_VIS
- DECLARE_ALIGNED(8, uint64_t, sparc_coeffs)[10];
-#endif
-
- /* function pointers for swScale() */
+ /* function pointers for swscale() */
yuv2planar1_fn yuv2plane1;
yuv2planarX_fn yuv2planeX;
yuv2interleavedX_fn yuv2nv12cX;
/**
* Functions to read planar input, such as planar RGB, and convert
- * internally to Y/UV.
+ * internally to Y/UV/A.
*/
/** @{ */
void (*readLumPlanar)(uint8_t *dst, const uint8_t *src[4], int width);
void (*readChrPlanar)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src[4],
int width);
+ void (*readAlpPlanar)(uint8_t *dst, const uint8_t *src[4], int width);
/** @} */
/**
* Scale one horizontal line of input data using a bilinear filter
* to produce one line of output data. Compared to SwsContext->hScale(),
* please take note of the following caveats when using these:
- * - Scaling is done using only 7bit instead of 14bit coefficients.
+ * - Scaling is done using only 7 bits instead of 14-bit coefficients.
* - You can use no more than 5 input pixels to produce 4 output
* pixels. Therefore, this filter should not be used for downscaling
* by more than ~20% in width (because that equals more than 5/4th
* @param dst pointer to destination buffer for horizontally scaled
* data. If the number of bits per component of one
* destination pixel (SwsContext->dstBpc) is <= 10, data
- * will be 15bpc in 16bits (int16_t) width. Else (i.e.
+ * will be 15 bpc in 16 bits (int16_t) width. Else (i.e.
* SwsContext->dstBpc == 16), data will be 19bpc in
- * 32bits (int32_t) width.
+ * 32 bits (int32_t) width.
* @param dstW width of destination image
* @param src pointer to source data to be scaled. If the number of
* bits per component of a source pixel (SwsContext->srcBpc)
- * is 8, this is 8bpc in 8bits (uint8_t) width. Else
+ * is 8, this is 8bpc in 8 bits (uint8_t) width. Else
* (i.e. SwsContext->dstBpc > 8), this is native depth
- * in 16bits (uint16_t) width. In other words, for 9-bit
+ * in 16 bits (uint16_t) width. In other words, for 9-bit
* YUV input, this is 9bpc, for 10-bit YUV input, this is
* 10bpc, and for 16-bit RGB or YUV, this is 16bpc.
* @param filter filter coefficients to be used per output pixel for
int lastInLumBuf, int lastInChrBuf);
SwsFunc ff_yuv2rgb_init_x86(SwsContext *c);
-SwsFunc ff_yuv2rgb_init_vis(SwsContext *c);
SwsFunc ff_yuv2rgb_init_ppc(SwsContext *c);
-SwsFunc ff_yuv2rgb_init_bfin(SwsContext *c);
const char *sws_format_name(enum AVPixelFormat format);
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc);
- return desc->comp[0].depth_minus1 == 15;
+ return desc->comp[0].depth == 16;
}
-static av_always_inline int is9_OR_10BPS(enum AVPixelFormat pix_fmt)
+static av_always_inline int is9_15BPS(enum AVPixelFormat pix_fmt)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc);
- return desc->comp[0].depth_minus1 == 8 || desc->comp[0].depth_minus1 == 9;
+ return desc->comp[0].depth >= 9 && desc->comp[0].depth <= 15;
}
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
return (desc->flags & AV_PIX_FMT_FLAG_RGB);
}
-#if 0 // FIXME
-#define isGray(x) \
- (!(av_pix_fmt_descriptors[x].flags & AV_PIX_FMT_FLAG_PAL) && \
- av_pix_fmt_descriptors[x].nb_components <= 2)
-#else
#define isGray(x) \
((x) == AV_PIX_FMT_GRAY8 || \
- (x) == AV_PIX_FMT_Y400A || \
+ (x) == AV_PIX_FMT_YA8 || \
+ (x) == AV_PIX_FMT_GRAY12BE || \
+ (x) == AV_PIX_FMT_GRAY12LE || \
(x) == AV_PIX_FMT_GRAY16BE || \
- (x) == AV_PIX_FMT_GRAY16LE)
-#endif
+ (x) == AV_PIX_FMT_GRAY16LE || \
+ (x) == AV_PIX_FMT_YA16BE || \
+ (x) == AV_PIX_FMT_YA16LE)
#define isRGBinInt(x) \
((x) == AV_PIX_FMT_RGB48BE || \
(x) == AV_PIX_FMT_RGB8 || \
(x) == AV_PIX_FMT_RGB4 || \
(x) == AV_PIX_FMT_RGB4_BYTE || \
+ (x) == AV_PIX_FMT_RGBA64BE || \
+ (x) == AV_PIX_FMT_RGBA64LE || \
(x) == AV_PIX_FMT_MONOBLACK || \
(x) == AV_PIX_FMT_MONOWHITE)
(x) == AV_PIX_FMT_BGR8 || \
(x) == AV_PIX_FMT_BGR4 || \
(x) == AV_PIX_FMT_BGR4_BYTE || \
+ (x) == AV_PIX_FMT_BGRA64BE || \
+ (x) == AV_PIX_FMT_BGRA64LE || \
(x) == AV_PIX_FMT_MONOBLACK || \
(x) == AV_PIX_FMT_MONOWHITE)
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc);
return ((desc->flags & AV_PIX_FMT_FLAG_PAL) || (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) ||
- pix_fmt == AV_PIX_FMT_Y400A);
+ pix_fmt == AV_PIX_FMT_YA8);
}
extern const uint64_t ff_dither4[2];
extern const int32_t ff_yuv2rgb_coeffs[8][4];
-extern const AVClass sws_context_class;
+extern const AVClass ff_sws_context_class;
/**
- * Set c->swScale to an unscaled converter if one exists for the specific
+ * Set c->swscale to an unscaled converter if one exists for the specific
* source and destination formats, bit depths, flags, etc.
*/
void ff_get_unscaled_swscale(SwsContext *c);
-void ff_get_unscaled_swscale_bfin(SwsContext *c);
void ff_get_unscaled_swscale_ppc(SwsContext *c);
/**