Mercurial > libavcodec.hg
comparison ppc/dsputil_altivec.c @ 3546:5f97ba9a4eaa libavcodec
Almost cosmetic changes in dsputil_init_ppc and vorbis_inverse_coupling_altivec:
- whitespace consistency 2->4 [dsputil_init_ppc]
- reorder struct initialization with dsputil_init_altivec [dsputil_init_ppc]
- use casts instead of temp variables [vorbis_inverse_coupling_altivec]
author | lu_zero |
---|---|
date | Thu, 03 Aug 2006 16:13:50 +0000 |
parents | e2a589e55906 |
children | 7b4e34f1ff1f |
comparison
equal
deleted
inserted
replaced
3545:e2a589e55906 | 3546:5f97ba9a4eaa |
---|---|
1700 | 1700 |
1701 static void vorbis_inverse_coupling_altivec(float *mag, float *ang, | 1701 static void vorbis_inverse_coupling_altivec(float *mag, float *ang, |
1702 int blocksize) | 1702 int blocksize) |
1703 { | 1703 { |
1704 int i; | 1704 int i; |
1705 vector float m, a, s0, s1; | 1705 vector float m, a; |
1706 vector bool int t0, t1; | 1706 vector bool int t0, t1; |
1707 const vector unsigned int v_31 = //XXX | 1707 const vector unsigned int v_31 = //XXX |
1708 vec_add(vec_add(vec_splat_u32(15),vec_splat_u32(15)),vec_splat_u32(1)); | 1708 vec_add(vec_add(vec_splat_u32(15),vec_splat_u32(15)),vec_splat_u32(1)); |
1709 for(i=0; i<blocksize; i+=4) { | 1709 for(i=0; i<blocksize; i+=4) { |
1710 m = vec_ld(0, mag+i); | 1710 m = vec_ld(0, mag+i); |
1711 a = vec_ld(0, ang+i); | 1711 a = vec_ld(0, ang+i); |
1712 t0 = vec_cmple(m, (vector float)vec_splat_u32(0)); | 1712 t0 = vec_cmple(m, (vector float)vec_splat_u32(0)); |
1713 t1 = vec_cmple(a, (vector float)vec_splat_u32(0)); | 1713 t1 = vec_cmple(a, (vector float)vec_splat_u32(0)); |
1714 a = vec_xor(a, (vector float) vec_sl((vector unsigned int)t0, v_31)); | 1714 a = vec_xor(a, (vector float) vec_sl((vector unsigned int)t0, v_31)); |
1715 s0 = vec_and(a, t1); | 1715 t0 = (vector bool int)vec_and(a, t1); |
1716 s1 = vec_andc(a, t1); | 1716 t1 = (vector bool int)vec_andc(a, t1); |
1717 a = vec_add(m, s0); | 1717 a = vec_add(m, (vector float)t0); |
1718 m = vec_sub(m, s1); | 1718 m = vec_sub(m, (vector float)t1); |
1719 vec_ste(a, 0, ang+i); | 1719 vec_ste(a, 0, ang+i); |
1720 vec_ste(m, 0, mag+i); | 1720 vec_ste(m, 0, mag+i); |
1721 } | 1721 } |
1722 } | 1722 } |
1723 | 1723 |
1828 } | 1828 } |
1829 | 1829 |
1830 POWERPC_PERF_STOP_COUNT(altivec_avg_pixels8_xy2_num, 1); | 1830 POWERPC_PERF_STOP_COUNT(altivec_avg_pixels8_xy2_num, 1); |
1831 #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ | 1831 #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ |
1832 } | 1832 } |
1833 | |
1834 void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx) | |
1835 { | |
1836 c->pix_abs[0][1] = sad16_x2_altivec; | |
1837 c->pix_abs[0][2] = sad16_y2_altivec; | |
1838 c->pix_abs[0][3] = sad16_xy2_altivec; | |
1839 c->pix_abs[0][0] = sad16_altivec; | |
1840 c->pix_abs[1][0] = sad8_altivec; | |
1841 c->sad[0]= sad16_altivec; | |
1842 c->sad[1]= sad8_altivec; | |
1843 c->pix_norm1 = pix_norm1_altivec; | |
1844 c->sse[1]= sse8_altivec; | |
1845 c->sse[0]= sse16_altivec; | |
1846 c->pix_sum = pix_sum_altivec; | |
1847 c->diff_pixels = diff_pixels_altivec; | |
1848 c->get_pixels = get_pixels_altivec; | |
1849 // next one disabled as it's untested. | |
1850 #if 0 | |
1851 c->add_bytes= add_bytes_altivec; | |
1852 #endif /* 0 */ | |
1853 c->put_pixels_tab[0][0] = put_pixels16_altivec; | |
1854 /* the two functions do the same thing, so use the same code */ | |
1855 c->put_no_rnd_pixels_tab[0][0] = put_pixels16_altivec; | |
1856 c->avg_pixels_tab[0][0] = avg_pixels16_altivec; | |
1857 c->avg_pixels_tab[1][0] = avg_pixels8_altivec; | |
1858 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_altivec; | |
1859 c->put_pixels_tab[1][3] = put_pixels8_xy2_altivec; | |
1860 c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_altivec; | |
1861 c->put_pixels_tab[0][3] = put_pixels16_xy2_altivec; | |
1862 c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_altivec; | |
1863 | |
1864 c->hadamard8_diff[0] = hadamard8_diff16_altivec; | |
1865 c->hadamard8_diff[1] = hadamard8_diff8x8_altivec; | |
1866 c->vorbis_inverse_coupling = vorbis_inverse_coupling_altivec; | |
1867 } |