Libav 0.7.1
|
00001 /* 00002 * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder 00003 * Copyright (c) 2003-2010 Michael Niedermayer <michaelni@gmx.at> 00004 * 00005 * This file is part of Libav. 00006 * 00007 * Libav is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * Libav is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with Libav; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 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) 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 c->h264_idct_add8 = FUNC(ff_h264_idct_add8, depth);\ 00057 c->h264_idct_add16intra= FUNC(ff_h264_idct_add16intra, depth);\ 00058 c->h264_luma_dc_dequant_idct= FUNC(ff_h264_luma_dc_dequant_idct, depth);\ 00059 c->h264_chroma_dc_dequant_idct= FUNC(ff_h264_chroma_dc_dequant_idct, depth);\ 00060 \ 00061 c->weight_h264_pixels_tab[0]= FUNC(weight_h264_pixels16x16, depth);\ 00062 c->weight_h264_pixels_tab[1]= FUNC(weight_h264_pixels16x8, depth);\ 00063 c->weight_h264_pixels_tab[2]= FUNC(weight_h264_pixels8x16, depth);\ 00064 c->weight_h264_pixels_tab[3]= FUNC(weight_h264_pixels8x8, depth);\ 00065 c->weight_h264_pixels_tab[4]= FUNC(weight_h264_pixels8x4, depth);\ 00066 c->weight_h264_pixels_tab[5]= FUNC(weight_h264_pixels4x8, depth);\ 00067 c->weight_h264_pixels_tab[6]= FUNC(weight_h264_pixels4x4, depth);\ 00068 c->weight_h264_pixels_tab[7]= FUNC(weight_h264_pixels4x2, depth);\ 00069 c->weight_h264_pixels_tab[8]= FUNC(weight_h264_pixels2x4, depth);\ 00070 c->weight_h264_pixels_tab[9]= FUNC(weight_h264_pixels2x2, depth);\ 00071 c->biweight_h264_pixels_tab[0]= FUNC(biweight_h264_pixels16x16, depth);\ 00072 c->biweight_h264_pixels_tab[1]= FUNC(biweight_h264_pixels16x8, depth);\ 00073 c->biweight_h264_pixels_tab[2]= FUNC(biweight_h264_pixels8x16, depth);\ 00074 c->biweight_h264_pixels_tab[3]= FUNC(biweight_h264_pixels8x8, depth);\ 00075 c->biweight_h264_pixels_tab[4]= FUNC(biweight_h264_pixels8x4, depth);\ 00076 c->biweight_h264_pixels_tab[5]= FUNC(biweight_h264_pixels4x8, depth);\ 00077 c->biweight_h264_pixels_tab[6]= FUNC(biweight_h264_pixels4x4, depth);\ 00078 c->biweight_h264_pixels_tab[7]= FUNC(biweight_h264_pixels4x2, depth);\ 00079 c->biweight_h264_pixels_tab[8]= FUNC(biweight_h264_pixels2x4, depth);\ 00080 c->biweight_h264_pixels_tab[9]= FUNC(biweight_h264_pixels2x2, depth);\ 00081 \ 00082 c->h264_v_loop_filter_luma= FUNC(h264_v_loop_filter_luma, depth);\ 00083 c->h264_h_loop_filter_luma= FUNC(h264_h_loop_filter_luma, depth);\ 00084 c->h264_h_loop_filter_luma_mbaff= FUNC(h264_h_loop_filter_luma_mbaff, depth);\ 00085 c->h264_v_loop_filter_luma_intra= FUNC(h264_v_loop_filter_luma_intra, depth);\ 00086 c->h264_h_loop_filter_luma_intra= FUNC(h264_h_loop_filter_luma_intra, depth);\ 00087 c->h264_h_loop_filter_luma_mbaff_intra= FUNC(h264_h_loop_filter_luma_mbaff_intra, depth);\ 00088 c->h264_v_loop_filter_chroma= FUNC(h264_v_loop_filter_chroma, depth);\ 00089 c->h264_h_loop_filter_chroma= FUNC(h264_h_loop_filter_chroma, depth);\ 00090 c->h264_h_loop_filter_chroma_mbaff= FUNC(h264_h_loop_filter_chroma_mbaff, depth);\ 00091 c->h264_v_loop_filter_chroma_intra= FUNC(h264_v_loop_filter_chroma_intra, depth);\ 00092 c->h264_h_loop_filter_chroma_intra= FUNC(h264_h_loop_filter_chroma_intra, depth);\ 00093 c->h264_h_loop_filter_chroma_mbaff_intra= FUNC(h264_h_loop_filter_chroma_mbaff_intra, depth);\ 00094 c->h264_loop_filter_strength= NULL; 00095 00096 switch (bit_depth) { 00097 case 9: 00098 H264_DSP(9); 00099 break; 00100 case 10: 00101 H264_DSP(10); 00102 break; 00103 default: 00104 H264_DSP(8); 00105 break; 00106 } 00107 00108 if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth); 00109 if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c, bit_depth); 00110 if (HAVE_MMX) ff_h264dsp_init_x86(c, bit_depth); 00111 }