aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/ppc
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-08-13 22:23:40 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-13 22:24:47 +0200
commitca1dfea12771b585846fb86aa08c3d7f066a3cc4 (patch)
tree6db034b36245b9fe51d9a41d41be1718a3be8b89 /libswscale/ppc
parent75af0e6a1601a4246d6409ca28dc80a3ba0e8d6e (diff)
parent3304a1e69a8a050eb66d2304acd2d01354fa1aac (diff)
downloadffmpeg-ca1dfea12771b585846fb86aa08c3d7f066a3cc4.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: swscale: add dithering to yuv2yuvX_altivec_real rv34: free+allocate buffer instead of reallocating it to preserve alignment h264: add missing brackets. swscale: use 15-bit intermediates for 9/10-bit scaling. Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/ppc')
-rw-r--r--libswscale/ppc/swscale_altivec.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c
index 8bc0ddd9d8..8a5bac308e 100644
--- a/libswscale/ppc/swscale_altivec.c
+++ b/libswscale/ppc/swscale_altivec.c
@@ -92,6 +92,7 @@ altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW)
}
}
+//FIXME remove the usage of scratch buffers.
static void
yuv2yuvX_altivec_real(SwsContext *c,
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 *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;
{
DECLARE_ALIGNED(16, int, val)[dstW];
- for (i = 0; i < (dstW -7); i+=4) {
- vec_st(vini, i << 2, val);
- }
- for (; i < dstW; i++) {
- val[i] = (1 << 18);
- }
+ for (i=0; i<dstW; i++)
+ val[i] = lumDither[i & 7] << 12;
for (j = 0; j < lumFilterSize; j++) {
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, v)[chrDstW];
- for (i = 0; i < (chrDstW -7); i+=4) {
- vec_st(vini, i << 2, u);
- vec_st(vini, i << 2, v);
- }
- for (; i < chrDstW; i++) {
- u[i] = (1 << 18);
- v[i] = (1 << 18);
+ for (i=0; i<chrDstW; i++) {
+ u[i] = chrDither[i & 7] << 12;
+ v[i] = chrDither[(i + 3) & 7] << 12;
}
for (j = 0; j < chrFilterSize; j++) {
@@ -406,7 +399,7 @@ void ff_sws_init_swScale_altivec(SwsContext *c)
if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))
return;
- if (c->scalingBpp == 8) {
+ if (c->srcBpc == 8 && c->dstBpc <= 10) {
c->hScale = hScale_altivec_real;
}
if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) &&