00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00028 #include <stdint.h>
00029 #include "avcodec.h"
00030 #include "h264dsp.h"
00031
00032 #define BIT_DEPTH 8
00033 #include "h264dsp_template.c"
00034 #undef BIT_DEPTH
00035
00036 #define BIT_DEPTH 9
00037 #include "h264dsp_template.c"
00038 #undef BIT_DEPTH
00039
00040 #define BIT_DEPTH 10
00041 #include "h264dsp_template.c"
00042 #undef BIT_DEPTH
00043
00044 void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
00045 {
00046 #undef FUNC
00047 #define FUNC(a, depth) a ## _ ## depth ## _c
00048
00049 #define H264_DSP(depth) \
00050 c->h264_idct_add= FUNC(ff_h264_idct_add, depth);\
00051 c->h264_idct8_add= FUNC(ff_h264_idct8_add, depth);\
00052 c->h264_idct_dc_add= FUNC(ff_h264_idct_dc_add, depth);\
00053 c->h264_idct8_dc_add= FUNC(ff_h264_idct8_dc_add, depth);\
00054 c->h264_idct_add16 = FUNC(ff_h264_idct_add16, depth);\
00055 c->h264_idct8_add4 = FUNC(ff_h264_idct8_add4, depth);\
00056 if (chroma_format_idc == 1)\
00057 c->h264_idct_add8 = FUNC(ff_h264_idct_add8, depth);\
00058 else\
00059 c->h264_idct_add8 = FUNC(ff_h264_idct_add8_422, depth);\
00060 c->h264_idct_add16intra= FUNC(ff_h264_idct_add16intra, depth);\
00061 c->h264_luma_dc_dequant_idct= FUNC(ff_h264_luma_dc_dequant_idct, depth);\
00062 if (chroma_format_idc == 1)\
00063 c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma_dc_dequant_idct, depth);\
00064 else\
00065 c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma422_dc_dequant_idct, depth);\
00066 \
00067 c->weight_h264_pixels_tab[0]= FUNC(weight_h264_pixels16, depth);\
00068 c->weight_h264_pixels_tab[1]= FUNC(weight_h264_pixels8, depth);\
00069 c->weight_h264_pixels_tab[2]= FUNC(weight_h264_pixels4, depth);\
00070 c->weight_h264_pixels_tab[3]= FUNC(weight_h264_pixels2, depth);\
00071 c->biweight_h264_pixels_tab[0]= FUNC(biweight_h264_pixels16, depth);\
00072 c->biweight_h264_pixels_tab[1]= FUNC(biweight_h264_pixels8, depth);\
00073 c->biweight_h264_pixels_tab[2]= FUNC(biweight_h264_pixels4, depth);\
00074 c->biweight_h264_pixels_tab[3]= FUNC(biweight_h264_pixels2, depth);\
00075 \
00076 c->h264_v_loop_filter_luma= FUNC(h264_v_loop_filter_luma, depth);\
00077 c->h264_h_loop_filter_luma= FUNC(h264_h_loop_filter_luma, depth);\
00078 c->h264_h_loop_filter_luma_mbaff= FUNC(h264_h_loop_filter_luma_mbaff, depth);\
00079 c->h264_v_loop_filter_luma_intra= FUNC(h264_v_loop_filter_luma_intra, depth);\
00080 c->h264_h_loop_filter_luma_intra= FUNC(h264_h_loop_filter_luma_intra, depth);\
00081 c->h264_h_loop_filter_luma_mbaff_intra= FUNC(h264_h_loop_filter_luma_mbaff_intra, depth);\
00082 c->h264_v_loop_filter_chroma= FUNC(h264_v_loop_filter_chroma, depth);\
00083 if (chroma_format_idc == 1)\
00084 c->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma, depth);\
00085 else\
00086 c->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma422, depth);\
00087 if (chroma_format_idc == 1)\
00088 c->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma_mbaff, depth);\
00089 else\
00090 c->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma422_mbaff, depth);\
00091 c->h264_v_loop_filter_chroma_intra= FUNC(h264_v_loop_filter_chroma_intra, depth);\
00092 if (chroma_format_idc == 1)\
00093 c->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma_intra, depth);\
00094 else\
00095 c->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma422_intra, depth);\
00096 if (chroma_format_idc == 1)\
00097 c->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma_mbaff_intra, depth);\
00098 else\
00099 c->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma422_mbaff_intra, depth);\
00100 c->h264_loop_filter_strength= NULL;
00101
00102 switch (bit_depth) {
00103 case 9:
00104 H264_DSP(9);
00105 break;
00106 case 10:
00107 H264_DSP(10);
00108 break;
00109 default:
00110 H264_DSP(8);
00111 break;
00112 }
00113
00114 if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc);
00115 if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc);
00116 if (HAVE_MMX) ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc);
00117 }