Add C version of ff_h264_idct8_dc_add in AltiVec so that ff_h264_idct8_add_altivec can be used. Originally committed as revision 16311 to svn://svn.ffmpeg.org/ffmpeg/trunk
Showing the changes to libavcodec/ppc (1 of 1 file). Show all
Unified · Split
| @@ -19,6 +19,7 @@ · 18 unmodified lines | |||
| 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 | ||
| @@ -595,6 +596,30 @@ void ff_h264_idct8_add_altivec( uint8_t *dst, DCTELEM *dct, int stride ) { · 570 unmodified lines | |||
| 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); |
| 596 | } | 597 | } |
| 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 | } | ||
| 621 | } | ||
| 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; \ |
| @@ -874,8 +899,12 @@ void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) { · 273 unmodified lines | |||
| 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 | ||