swscale: add dithering to yuv2yuvX_altivec_real
It just does that part in scalar form, I doubt using a vector store over 2 array would speed it up particularly. The function should be written to not use a scratch buffer.
This commit is contained in:
@ -92,6 +92,7 @@ altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME remove the usage of scratch buffers.
|
||||||
static void
|
static void
|
||||||
yuv2yuvX_altivec_real(SwsContext *c,
|
yuv2yuvX_altivec_real(SwsContext *c,
|
||||||
const int16_t *lumFilter, const int16_t **lumSrc,
|
const int16_t *lumFilter, const int16_t **lumSrc,
|
||||||
@ -101,17 +102,13 @@ yuv2yuvX_altivec_real(SwsContext *c,
|
|||||||
uint8_t *dest[4], int dstW, int chrDstW)
|
uint8_t *dest[4], int dstW, int chrDstW)
|
||||||
{
|
{
|
||||||
uint8_t *yDest = dest[0], *uDest = dest[1], *vDest = dest[2];
|
uint8_t *yDest = dest[0], *uDest = dest[1], *vDest = dest[2];
|
||||||
const vector signed int vini = {(1 << 18), (1 << 18), (1 << 18), (1 << 18)};
|
const uint8_t *lumDither = c->lumDither8, *chrDither = c->chrDither8;
|
||||||
register int i, j;
|
register int i, j;
|
||||||
{
|
{
|
||||||
DECLARE_ALIGNED(16, int, val)[dstW];
|
DECLARE_ALIGNED(16, int, val)[dstW];
|
||||||
|
|
||||||
for (i = 0; i < (dstW -7); i+=4) {
|
for (i=0; i<dstW; i++)
|
||||||
vec_st(vini, i << 2, val);
|
val[i] = lumDither[i & 7] << 12;
|
||||||
}
|
|
||||||
for (; i < dstW; i++) {
|
|
||||||
val[i] = (1 << 18);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (j = 0; j < lumFilterSize; j++) {
|
for (j = 0; j < lumFilterSize; j++) {
|
||||||
vector signed short l1, vLumFilter = vec_ld(j << 1, lumFilter);
|
vector signed short l1, vLumFilter = vec_ld(j << 1, lumFilter);
|
||||||
@ -155,13 +152,9 @@ yuv2yuvX_altivec_real(SwsContext *c,
|
|||||||
DECLARE_ALIGNED(16, int, u)[chrDstW];
|
DECLARE_ALIGNED(16, int, u)[chrDstW];
|
||||||
DECLARE_ALIGNED(16, int, v)[chrDstW];
|
DECLARE_ALIGNED(16, int, v)[chrDstW];
|
||||||
|
|
||||||
for (i = 0; i < (chrDstW -7); i+=4) {
|
for (i=0; i<chrDstW; i++) {
|
||||||
vec_st(vini, i << 2, u);
|
u[i] = chrDither[i & 7] << 12;
|
||||||
vec_st(vini, i << 2, v);
|
v[i] = chrDither[(i + 3) & 7] << 12;
|
||||||
}
|
|
||||||
for (; i < chrDstW; i++) {
|
|
||||||
u[i] = (1 << 18);
|
|
||||||
v[i] = (1 << 18);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < chrFilterSize; j++) {
|
for (j = 0; j < chrFilterSize; j++) {
|
||||||
|
Reference in New Issue
Block a user