comparison ppc/h264_altivec.c @ 11499:2a4dc3c0b012 libavcodec

Move H264 dsputil functions into their own struct This moves the H264-specific functions from DSPContext to the new H264DSPContext. The code is made conditional on CONFIG_H264DSP which is set by the codecs requiring it. The qpel and chroma MC functions are not moved as these are used by non-h264 code.
author mru
date Tue, 16 Mar 2010 01:17:00 +0000
parents 50415a8f1451
children 3cd4cd0509cd
comparison
equal deleted inserted replaced
11498:8e889ce0d616 11499:2a4dc3c0b012
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 #include "libavcodec/h264data.h"
23 #include "libavcodec/h264dsp.h"
23 24
24 #include "dsputil_ppc.h" 25 #include "dsputil_ppc.h"
25 #include "dsputil_altivec.h" 26 #include "dsputil_altivec.h"
26 #include "util_altivec.h" 27 #include "util_altivec.h"
27 #include "types_altivec.h" 28 #include "types_altivec.h"
972 if (has_altivec()) { 973 if (has_altivec()) {
973 c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec; 974 c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec;
974 c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec; 975 c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec;
975 c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec; 976 c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec;
976 c->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec; 977 c->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec;
977 c->h264_idct_add = ff_h264_idct_add_altivec;
978 c->h264_idct_add8 = ff_h264_idct_add8_altivec;
979 c->h264_idct_add16 = ff_h264_idct_add16_altivec;
980 c->h264_idct_add16intra = ff_h264_idct_add16intra_altivec;
981 c->h264_idct_dc_add= h264_idct_dc_add_altivec;
982 c->h264_idct8_dc_add = ff_h264_idct8_dc_add_altivec;
983 c->h264_idct8_add = ff_h264_idct8_add_altivec;
984 c->h264_idct8_add4 = ff_h264_idct8_add4_altivec;
985 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_altivec;
986 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_altivec;
987 978
988 #define dspfunc(PFX, IDX, NUM) \ 979 #define dspfunc(PFX, IDX, NUM) \
989 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \ 980 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \
990 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_altivec; \ 981 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_altivec; \
991 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_altivec; \ 982 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_altivec; \
1004 c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_altivec 995 c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_altivec
1005 996
1006 dspfunc(put_h264_qpel, 0, 16); 997 dspfunc(put_h264_qpel, 0, 16);
1007 dspfunc(avg_h264_qpel, 0, 16); 998 dspfunc(avg_h264_qpel, 0, 16);
1008 #undef dspfunc 999 #undef dspfunc
1000 }
1001 }
1002
1003 void ff_h264dsp_init_ppc(H264DSPContext *c)
1004 {
1005 if (has_altivec()) {
1006 c->h264_idct_add = ff_h264_idct_add_altivec;
1007 c->h264_idct_add8 = ff_h264_idct_add8_altivec;
1008 c->h264_idct_add16 = ff_h264_idct_add16_altivec;
1009 c->h264_idct_add16intra = ff_h264_idct_add16intra_altivec;
1010 c->h264_idct_dc_add= h264_idct_dc_add_altivec;
1011 c->h264_idct8_dc_add = ff_h264_idct8_dc_add_altivec;
1012 c->h264_idct8_add = ff_h264_idct8_add_altivec;
1013 c->h264_idct8_add4 = ff_h264_idct8_add4_altivec;
1014 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_altivec;
1015 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_altivec;
1009 1016
1010 c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels16x16_altivec; 1017 c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels16x16_altivec;
1011 c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels16x8_altivec; 1018 c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels16x8_altivec;
1012 c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels8x16_altivec; 1019 c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels8x16_altivec;
1013 c->weight_h264_pixels_tab[3] = ff_weight_h264_pixels8x8_altivec; 1020 c->weight_h264_pixels_tab[3] = ff_weight_h264_pixels8x8_altivec;