diff options
author | Diego Biurrun <diego@biurrun.de> | 2013-11-05 08:11:47 +0100 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2013-11-08 12:40:47 +0100 |
commit | 0338c396987c82b41d322630ea9712fe5f9561d6 (patch) | |
tree | 62c5b48c7705ecfb62fb667683b72436c48490e9 | |
parent | 86f910806b2c303c43727d357a5b927e662bb3d1 (diff) | |
download | ffmpeg-0338c396987c82b41d322630ea9712fe5f9561d6.tar.gz |
dsputil: Split off H.263 bits into their own H263DSPContext
-rwxr-xr-x | configure | 9 | ||||
-rw-r--r-- | libavcodec/Makefile | 1 | ||||
-rw-r--r-- | libavcodec/dsputil.c | 79 | ||||
-rw-r--r-- | libavcodec/dsputil.h | 3 | ||||
-rw-r--r-- | libavcodec/h263.c | 32 | ||||
-rw-r--r-- | libavcodec/h263data.h | 5 | ||||
-rw-r--r-- | libavcodec/h263dec.c | 1 | ||||
-rw-r--r-- | libavcodec/h263dsp.c | 108 | ||||
-rw-r--r-- | libavcodec/h263dsp.h | 34 | ||||
-rw-r--r-- | libavcodec/mpegvideo.h | 3 | ||||
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 1 | ||||
-rw-r--r-- | libavcodec/rv10.c | 1 | ||||
-rw-r--r-- | libavcodec/x86/Makefile | 4 | ||||
-rw-r--r-- | libavcodec/x86/dsputil_init.c | 8 | ||||
-rw-r--r-- | libavcodec/x86/h263dsp_init.c | 39 |
15 files changed, 210 insertions, 118 deletions
@@ -1384,6 +1384,7 @@ CONFIG_EXTRA=" gcrypt golomb gplv3 + h263dsp h264chroma h264dsp h264pred @@ -1598,8 +1599,8 @@ g2m_decoder_deps="zlib" g2m_decoder_select="dsputil" h261_decoder_select="error_resilience mpegvideo" h261_encoder_select="aandcttables mpegvideoenc" -h263_decoder_select="error_resilience h263_parser mpegvideo" -h263_encoder_select="aandcttables mpegvideoenc" +h263_decoder_select="error_resilience h263_parser h263dsp mpegvideo" +h263_encoder_select="aandcttables h263dsp mpegvideoenc" h263i_decoder_select="h263_decoder" h263p_encoder_select="h263_encoder" h264_decoder_select="golomb h264chroma h264dsp h264pred h264qpel videodsp" @@ -1665,9 +1666,9 @@ qcelp_decoder_select="lsp" qdm2_decoder_select="mdct rdft mpegaudiodsp" ra_144_encoder_select="audio_frame_queue lpc" ralf_decoder_select="golomb" -rv10_decoder_select="error_resilience h263_decoder" +rv10_decoder_select="error_resilience h263_decoder h263dsp" rv10_encoder_select="h263_encoder" -rv20_decoder_select="error_resilience h263_decoder" +rv20_decoder_select="error_resilience h263_decoder h263dsp" rv20_encoder_select="h263_encoder" rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp" rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 205359e877..03d7459bb6 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -41,6 +41,7 @@ FFT-OBJS-$(CONFIG_HARDCODED_TABLES) += cos_tables.o cos_fixed_tables.o OBJS-$(CONFIG_FFT) += avfft.o fft_fixed.o fft_float.o \ $(FFT-OBJS-yes) OBJS-$(CONFIG_GOLOMB) += golomb.o +OBJS-$(CONFIG_H263DSP) += h263dsp.o OBJS-$(CONFIG_H264CHROMA) += h264chroma.o OBJS-$(CONFIG_H264DSP) += h264dsp.o h264idct.o OBJS-$(CONFIG_H264PRED) += h264pred.o diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 6d93706fb0..5839eb3fcc 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -1409,80 +1409,6 @@ static void put_mspel8_mc22_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) wmv2_mspel8_v_lowpass(dst, halfH+8, stride, 8, 8); } -static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){ - if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { - int x; - const int strength= ff_h263_loop_filter_strength[qscale]; - - for(x=0; x<8; x++){ - int d1, d2, ad1; - int p0= src[x-2*stride]; - int p1= src[x-1*stride]; - int p2= src[x+0*stride]; - int p3= src[x+1*stride]; - int d = (p0 - p3 + 4*(p2 - p1)) / 8; - - if (d<-2*strength) d1= 0; - else if(d<- strength) d1=-2*strength - d; - else if(d< strength) d1= d; - else if(d< 2*strength) d1= 2*strength - d; - else d1= 0; - - p1 += d1; - p2 -= d1; - if(p1&256) p1= ~(p1>>31); - if(p2&256) p2= ~(p2>>31); - - src[x-1*stride] = p1; - src[x+0*stride] = p2; - - ad1= FFABS(d1)>>1; - - d2= av_clip((p0-p3)/4, -ad1, ad1); - - src[x-2*stride] = p0 - d2; - src[x+ stride] = p3 + d2; - } - } -} - -static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){ - if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { - int y; - const int strength= ff_h263_loop_filter_strength[qscale]; - - for(y=0; y<8; y++){ - int d1, d2, ad1; - int p0= src[y*stride-2]; - int p1= src[y*stride-1]; - int p2= src[y*stride+0]; - int p3= src[y*stride+1]; - int d = (p0 - p3 + 4*(p2 - p1)) / 8; - - if (d<-2*strength) d1= 0; - else if(d<- strength) d1=-2*strength - d; - else if(d< strength) d1= d; - else if(d< 2*strength) d1= 2*strength - d; - else d1= 0; - - p1 += d1; - p2 -= d1; - if(p1&256) p1= ~(p1>>31); - if(p2&256) p2= ~(p2>>31); - - src[y*stride-1] = p1; - src[y*stride+0] = p2; - - ad1= FFABS(d1)>>1; - - d2= av_clip((p0-p3)/4, -ad1, ad1); - - src[y*stride-2] = p0 - d2; - src[y*stride+1] = p3 + d2; - } - } -} - static inline int pix_abs16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) { int s, i; @@ -2701,11 +2627,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) c->bswap_buf= bswap_buf; c->bswap16_buf = bswap16_buf; - if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { - c->h263_h_loop_filter= h263_h_loop_filter_c; - c->h263_v_loop_filter= h263_v_loop_filter_c; - } - c->try_8x8basis= try_8x8basis_c; c->add_8x8basis= add_8x8basis_c; diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index c248b9f3a4..b110f080c9 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -202,9 +202,6 @@ typedef struct DSPContext { void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w); void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len); - void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale); - void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale); - /* assume len is a multiple of 8, and arrays are 16-byte aligned */ void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */); diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 0a7ec87ba1..2fa6ca3509 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -152,8 +152,8 @@ void ff_h263_loop_filter(MpegEncContext * s){ */ if (!IS_SKIP(s->current_picture.mb_type[xy])) { qp_c= s->qscale; - s->dsp.h263_v_loop_filter(dest_y+8*linesize , linesize, qp_c); - s->dsp.h263_v_loop_filter(dest_y+8*linesize+8, linesize, qp_c); + s->h263dsp.h263_v_loop_filter(dest_y + 8 * linesize, linesize, qp_c); + s->h263dsp.h263_v_loop_filter(dest_y + 8 * linesize + 8, linesize, qp_c); }else qp_c= 0; @@ -172,15 +172,15 @@ void ff_h263_loop_filter(MpegEncContext * s){ if(qp_tc){ const int chroma_qp= s->chroma_qscale_table[qp_tc]; - s->dsp.h263_v_loop_filter(dest_y , linesize, qp_tc); - s->dsp.h263_v_loop_filter(dest_y+8, linesize, qp_tc); + s->h263dsp.h263_v_loop_filter(dest_y, linesize, qp_tc); + s->h263dsp.h263_v_loop_filter(dest_y + 8, linesize, qp_tc); - s->dsp.h263_v_loop_filter(dest_cb , uvlinesize, chroma_qp); - s->dsp.h263_v_loop_filter(dest_cr , uvlinesize, chroma_qp); + s->h263dsp.h263_v_loop_filter(dest_cb, uvlinesize, chroma_qp); + s->h263dsp.h263_v_loop_filter(dest_cr, uvlinesize, chroma_qp); } if(qp_tt) - s->dsp.h263_h_loop_filter(dest_y-8*linesize+8 , linesize, qp_tt); + s->h263dsp.h263_h_loop_filter(dest_y - 8 * linesize + 8, linesize, qp_tt); if(s->mb_x){ if (qp_tt || IS_SKIP(s->current_picture.mb_type[xy - 1 - s->mb_stride])) @@ -190,17 +190,17 @@ void ff_h263_loop_filter(MpegEncContext * s){ if(qp_dt){ const int chroma_qp= s->chroma_qscale_table[qp_dt]; - s->dsp.h263_h_loop_filter(dest_y -8*linesize , linesize, qp_dt); - s->dsp.h263_h_loop_filter(dest_cb-8*uvlinesize, uvlinesize, chroma_qp); - s->dsp.h263_h_loop_filter(dest_cr-8*uvlinesize, uvlinesize, chroma_qp); + s->h263dsp.h263_h_loop_filter(dest_y - 8 * linesize, linesize, qp_dt); + s->h263dsp.h263_h_loop_filter(dest_cb - 8 * uvlinesize, uvlinesize, chroma_qp); + s->h263dsp.h263_h_loop_filter(dest_cr - 8 * uvlinesize, uvlinesize, chroma_qp); } } } if(qp_c){ - s->dsp.h263_h_loop_filter(dest_y +8, linesize, qp_c); + s->h263dsp.h263_h_loop_filter(dest_y + 8, linesize, qp_c); if(s->mb_y + 1 == s->mb_height) - s->dsp.h263_h_loop_filter(dest_y+8*linesize+8, linesize, qp_c); + s->h263dsp.h263_h_loop_filter(dest_y + 8 * linesize + 8, linesize, qp_c); } if(s->mb_x){ @@ -211,12 +211,12 @@ void ff_h263_loop_filter(MpegEncContext * s){ qp_lc = s->current_picture.qscale_table[xy - 1]; if(qp_lc){ - s->dsp.h263_h_loop_filter(dest_y, linesize, qp_lc); + s->h263dsp.h263_h_loop_filter(dest_y, linesize, qp_lc); if(s->mb_y + 1 == s->mb_height){ const int chroma_qp= s->chroma_qscale_table[qp_lc]; - s->dsp.h263_h_loop_filter(dest_y +8* linesize, linesize, qp_lc); - s->dsp.h263_h_loop_filter(dest_cb , uvlinesize, chroma_qp); - s->dsp.h263_h_loop_filter(dest_cr , uvlinesize, chroma_qp); + s->h263dsp.h263_h_loop_filter(dest_y + 8 * linesize, linesize, qp_lc); + s->h263dsp.h263_h_loop_filter(dest_cb, uvlinesize, chroma_qp); + s->h263dsp.h263_h_loop_filter(dest_cr, uvlinesize, chroma_qp); } } } diff --git a/libavcodec/h263data.h b/libavcodec/h263data.h index e3b83ad2e4..c966aab6d0 100644 --- a/libavcodec/h263data.h +++ b/libavcodec/h263data.h @@ -272,11 +272,6 @@ uint8_t ff_mba_length[7]={ 6, 7, 9, 11, 13, 14, 14 }; -const uint8_t ff_h263_loop_filter_strength[32]={ -// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 - 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10,10,11,11,11,12,12,12 -}; - const AVRational ff_h263_pixel_aspect[16]={ {0, 1}, {1, 1}, diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index c52fc00515..4c4a4c4310 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -116,6 +116,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) if ((ret = ff_MPV_common_init(s)) < 0) return ret; + ff_h263dsp_init(&s->h263dsp); ff_h263_decode_init_vlc(); return 0; diff --git a/libavcodec/h263dsp.c b/libavcodec/h263dsp.c new file mode 100644 index 0000000000..e1da6b8e28 --- /dev/null +++ b/libavcodec/h263dsp.c @@ -0,0 +1,108 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <stdint.h> + +#include "libavutil/attributes.h" +#include "libavutil/common.h" +#include "config.h" +#include "h263dsp.h" + +const uint8_t ff_h263_loop_filter_strength[32]={ +// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 + 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10,10,11,11,11,12,12,12 +}; + +static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){ + int y; + const int strength= ff_h263_loop_filter_strength[qscale]; + + for(y=0; y<8; y++){ + int d1, d2, ad1; + int p0= src[y*stride-2]; + int p1= src[y*stride-1]; + int p2= src[y*stride+0]; + int p3= src[y*stride+1]; + int d = (p0 - p3 + 4*(p2 - p1)) / 8; + + if (d<-2*strength) d1= 0; + else if(d<- strength) d1=-2*strength - d; + else if(d< strength) d1= d; + else if(d< 2*strength) d1= 2*strength - d; + else d1= 0; + + p1 += d1; + p2 -= d1; + if(p1&256) p1= ~(p1>>31); + if(p2&256) p2= ~(p2>>31); + + src[y*stride-1] = p1; + src[y*stride+0] = p2; + + ad1= FFABS(d1)>>1; + + d2= av_clip((p0-p3)/4, -ad1, ad1); + + src[y*stride-2] = p0 - d2; + src[y*stride+1] = p3 + d2; + } +} + +static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){ + int x; + const int strength= ff_h263_loop_filter_strength[qscale]; + + for(x=0; x<8; x++){ + int d1, d2, ad1; + int p0= src[x-2*stride]; + int p1= src[x-1*stride]; + int p2= src[x+0*stride]; + int p3= src[x+1*stride]; + int d = (p0 - p3 + 4*(p2 - p1)) / 8; + + if (d<-2*strength) d1= 0; + else if(d<- strength) d1=-2*strength - d; + else if(d< strength) d1= d; + else if(d< 2*strength) d1= 2*strength - d; + else d1= 0; + + p1 += d1; + p2 -= d1; + if(p1&256) p1= ~(p1>>31); + if(p2&256) p2= ~(p2>>31); + + src[x-1*stride] = p1; + src[x+0*stride] = p2; + + ad1= FFABS(d1)>>1; + + d2= av_clip((p0-p3)/4, -ad1, ad1); + + src[x-2*stride] = p0 - d2; + src[x+ stride] = p3 + d2; + } +} + +av_cold void ff_h263dsp_init(H263DSPContext *ctx) +{ + ctx->h263_h_loop_filter = h263_h_loop_filter_c; + ctx->h263_v_loop_filter = h263_v_loop_filter_c; + + if (ARCH_X86) + ff_h263dsp_init_x86(ctx); +} diff --git a/libavcodec/h263dsp.h b/libavcodec/h263dsp.h new file mode 100644 index 0000000000..40f041cd0d --- /dev/null +++ b/libavcodec/h263dsp.h @@ -0,0 +1,34 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_H263DSP_H +#define AVCODEC_H263DSP_H + +#include <stdint.h> + +extern const uint8_t ff_h263_loop_filter_strength[32]; + +typedef struct H263DSPContext { + void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale); + void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale); +} H263DSPContext; + +void ff_h263dsp_init(H263DSPContext *ctx); +void ff_h263dsp_init_x86(H263DSPContext *ctx); + +#endif /* AVCODEC_H263DSP_H */ diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 78792cf9a1..e492af463f 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -32,6 +32,7 @@ #include "dsputil.h" #include "error_resilience.h" #include "get_bits.h" +#include "h263dsp.h" #include "hpeldsp.h" #include "put_bits.h" #include "ratecontrol.h" @@ -384,6 +385,7 @@ typedef struct MpegEncContext { DSPContext dsp; ///< pointers for accelerated dsp functions HpelDSPContext hdsp; VideoDSPContext vdsp; + H263DSPContext h263dsp; int f_code; ///< forward MV resolution int b_code; ///< backward MV resolution for B Frames (mpeg4) int16_t (*p_mv_table_base)[2]; @@ -896,7 +898,6 @@ void ff_mpeg1_encode_slice_header(MpegEncContext *s); extern const uint8_t ff_aic_dc_scale_table[32]; extern const uint8_t ff_h263_chroma_qscale_table[32]; -extern const uint8_t ff_h263_loop_filter_strength[32]; /* rv10.c */ void ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number); diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index c2459960af..76ddc5d491 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -707,6 +707,7 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) if (ARCH_X86) ff_MPV_encode_init_x86(s); + ff_h263dsp_init(&s->h263dsp); if (!s->dct_quantize) s->dct_quantize = ff_dct_quantize_c; if (!s->denoise_dct) diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index f80625a891..944db5841c 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -484,6 +484,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) if ((ret = ff_MPV_common_init(s)) < 0) return ret; + ff_h263dsp_init(&s->h263dsp); ff_h263_decode_init_vlc(); /* init rv vlc */ diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile index 84dd49cf3c..0fe1c1af5e 100644 --- a/libavcodec/x86/Makefile +++ b/libavcodec/x86/Makefile @@ -12,6 +12,7 @@ OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o \ x86/fdct.o \ x86/motion_est.o OBJS-$(CONFIG_FFT) += x86/fft_init.o +OBJS-$(CONFIG_H263DSP) += x86/h263dsp_init.o OBJS-$(CONFIG_H264CHROMA) += x86/h264chroma_init.o OBJS-$(CONFIG_H264DSP) += x86/h264dsp_init.o OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o @@ -59,8 +60,7 @@ YASM-OBJS-$(CONFIG_DSPUTIL) += x86/dsputil.o \ x86/qpel.o YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc.o YASM-OBJS-$(CONFIG_FFT) += x86/fft.o -YASM-OBJS-$(CONFIG_H263_DECODER) += x86/h263_loopfilter.o -YASM-OBJS-$(CONFIG_H263_ENCODER) += x86/h263_loopfilter.o +YASM-OBJS-$(CONFIG_H263DSP) += x86/h263_loopfilter.o YASM-OBJS-$(CONFIG_H264CHROMA) += x86/h264_chromamc.o \ x86/h264_chromamc_10bit.o YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \ diff --git a/libavcodec/x86/dsputil_init.c b/libavcodec/x86/dsputil_init.c index a38cf24d3c..cc35d240a0 100644 --- a/libavcodec/x86/dsputil_init.c +++ b/libavcodec/x86/dsputil_init.c @@ -68,9 +68,6 @@ void ff_put_no_rnd_mpeg4_qpel8_v_lowpass_mmxext(uint8_t *dst, uint8_t *src, #define ff_put_no_rnd_pixels16_mmxext ff_put_pixels16_mmxext #define ff_put_no_rnd_pixels8_mmxext ff_put_pixels8_mmxext -void ff_h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale); -void ff_h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale); - int32_t ff_scalarproduct_int16_mmxext(const int16_t *v1, const int16_t *v2, int order); int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2, @@ -566,11 +563,6 @@ static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx, #endif /* HAVE_MMX_INLINE */ #if HAVE_MMX_EXTERNAL - if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { - c->h263_v_loop_filter = ff_h263_v_loop_filter_mmx; - c->h263_h_loop_filter = ff_h263_h_loop_filter_mmx; - } - c->vector_clip_int32 = ff_vector_clip_int32_mmx; #endif /* HAVE_MMX_EXTERNAL */ } diff --git a/libavcodec/x86/h263dsp_init.c b/libavcodec/x86/h263dsp_init.c new file mode 100644 index 0000000000..d4fab981bf --- /dev/null +++ b/libavcodec/x86/h263dsp_init.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2013 Diego Biurrun <diego@biurrun.de> + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <stdint.h> + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/x86/cpu.h" +#include "libavcodec/h263dsp.h" + +void ff_h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale); +void ff_h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale); + +av_cold void ff_h263dsp_init_x86(H263DSPContext *c) +{ + int cpu_flags = av_get_cpu_flags(); + + if (EXTERNAL_MMX(cpu_flags)) { + c->h263_h_loop_filter = ff_h263_h_loop_filter_mmx; + c->h263_v_loop_filter = ff_h263_v_loop_filter_mmx; + } +} |