comparison ppc/h264_altivec.c @ 8461:11307ea31e57 libavcodec

Disable usage of ff_h264_idct_add_altivec since AltiVec versions of h264_idct_add16, h264_idct_add16intra, h264_idct_add8 need to be implemented. Add C version of ff_h264_idct8_dc_add in AltiVec so that ff_h264_idct8_add_altivec can be used.
author gpoirier
date Thu, 25 Dec 2008 18:27:49 +0000
parents 5f3b62eaf6e5
children 1615d6b75ada
comparison
equal deleted inserted replaced
8460:5b3c90656fdf 8461:11307ea31e57
17 * License along with FFmpeg; if not, write to the Free Software 17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20 20
21 #include "libavcodec/dsputil.h" 21 #include "libavcodec/dsputil.h"
22 #include "libavcodec/h264data.h"
22 23
23 #include "gcc_fixes.h" 24 #include "gcc_fixes.h"
24 25
25 #include "dsputil_ppc.h" 26 #include "dsputil_ppc.h"
26 #include "dsputil_altivec.h" 27 #include "dsputil_altivec.h"
591 ALTIVEC_STORE_SUM_CLIP(&dst[3*stride], idct3, perm_ldv, perm_stv, sel); 592 ALTIVEC_STORE_SUM_CLIP(&dst[3*stride], idct3, perm_ldv, perm_stv, sel);
592 ALTIVEC_STORE_SUM_CLIP(&dst[4*stride], idct4, perm_ldv, perm_stv, sel); 593 ALTIVEC_STORE_SUM_CLIP(&dst[4*stride], idct4, perm_ldv, perm_stv, sel);
593 ALTIVEC_STORE_SUM_CLIP(&dst[5*stride], idct5, perm_ldv, perm_stv, sel); 594 ALTIVEC_STORE_SUM_CLIP(&dst[5*stride], idct5, perm_ldv, perm_stv, sel);
594 ALTIVEC_STORE_SUM_CLIP(&dst[6*stride], idct6, perm_ldv, perm_stv, sel); 595 ALTIVEC_STORE_SUM_CLIP(&dst[6*stride], idct6, perm_ldv, perm_stv, sel);
595 ALTIVEC_STORE_SUM_CLIP(&dst[7*stride], idct7, perm_ldv, perm_stv, sel); 596 ALTIVEC_STORE_SUM_CLIP(&dst[7*stride], idct7, perm_ldv, perm_stv, sel);
597 }
598
599 // TODO: implement this in AltiVec
600 static void ff_h264_idct8_dc_add_altivec(uint8_t *dst, DCTELEM *block, int stride) {
601 int i, j;
602 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
603 int dc = (block[0] + 32) >> 6;
604 for( j = 0; j < 8; j++ )
605 {
606 for( i = 0; i < 8; i++ )
607 dst[i] = cm[ dst[i] + dc ];
608 dst += stride;
609 }
610 }
611
612 static void ff_h264_idct8_add4_altivec(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
613 int i;
614 for(i=0; i<16; i+=4){
615 int nnz = nnzc[ scan8[i] ];
616 if(nnz){
617 if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_altivec(dst + block_offset[i], block + i*16, stride);
618 else ff_h264_idct8_add_altivec (dst + block_offset[i], block + i*16, stride);
619 }
620 }
596 } 621 }
597 622
598 #define transpose4x16(r0, r1, r2, r3) { \ 623 #define transpose4x16(r0, r1, r2, r3) { \
599 register vec_u8_t r4; \ 624 register vec_u8_t r4; \
600 register vec_u8_t r5; \ 625 register vec_u8_t r5; \
872 897
873 if (has_altivec()) { 898 if (has_altivec()) {
874 c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec; 899 c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec;
875 c->put_no_rnd_h264_chroma_pixels_tab[0] = put_no_rnd_h264_chroma_mc8_altivec; 900 c->put_no_rnd_h264_chroma_pixels_tab[0] = put_no_rnd_h264_chroma_mc8_altivec;
876 c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec; 901 c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec;
902 /* ff_h264_idct_add_altivec may be re-enabled once AltiVec versions of
903 h264_idct_add16, h264_idct_add16intra, h264_idct_add8 are implemented
877 c->h264_idct_add = ff_h264_idct_add_altivec; 904 c->h264_idct_add = ff_h264_idct_add_altivec;
905 */
878 c->h264_idct8_add = ff_h264_idct8_add_altivec; 906 c->h264_idct8_add = ff_h264_idct8_add_altivec;
907 c->h264_idct8_add4 = ff_h264_idct8_add4_altivec;
879 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_altivec; 908 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_altivec;
880 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_altivec; 909 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_altivec;
881 910
882 #define dspfunc(PFX, IDX, NUM) \ 911 #define dspfunc(PFX, IDX, NUM) \
883 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \ 912 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \