Kostya Shishkov <[email protected]> writes:

> diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
> index d318601..039cf0b 100644
> --- a/libavcodec/dsputil.c
> +++ b/libavcodec/dsputil.c
> @@ -1280,16 +1280,16 @@ static void wmv2_mspel8_h_lowpass(uint8_t *dst, 
> uint8_t *src, int dstStride, int
>  }
>
>  #if CONFIG_RV40_DECODER
> -static void put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
> +void ff_put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
>      put_pixels16_xy2_8_c(dst, src, stride, 16);
>  }
> -static void avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
> +void ff_avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
>      avg_pixels16_xy2_8_c(dst, src, stride, 16);
>  }
> -static void put_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){
> +void ff_put_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){
>      put_pixels8_xy2_8_c(dst, src, stride, 8);
>  }
> -static void avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){
> +void ff_avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){
>      avg_pixels8_xy2_8_c(dst, src, stride, 8);
>  }
>  #endif /* CONFIG_RV40_DECODER */

Is there no way to remove these from dsputil.c entirely?

> diff --git a/libavcodec/rv34dsp.h b/libavcodec/rv34dsp.h
> new file mode 100644
> index 0000000..3784fab
> --- /dev/null
> +++ b/libavcodec/rv34dsp.h
> @@ -0,0 +1,50 @@
> +/*
> + * RV30/40 decoder motion compensation functions
> + * Copyright (c) 2008 Konstantin Shishkov
> + *
> + * 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
> + */
> +
> +/**
> + * @file
> + * RV30/40 decoder motion compensation functions
> + */
> +
> +#ifndef AVCODEC_RV34DSP_H
> +#define AVCODEC_RV34DSP_H
> +
> +#include "dsputil.h"
> +
> +typedef struct RV34DSPContext {
> +    /* rv30 functions */
> +    qpel_mc_func put_rv30_tpel_pixels_tab[4][16];
> +    qpel_mc_func avg_rv30_tpel_pixels_tab[4][16];
> +
> +    /* rv40 functions */
> +    qpel_mc_func put_rv40_qpel_pixels_tab[4][16];
> +    qpel_mc_func avg_rv40_qpel_pixels_tab[4][16];
> +    h264_chroma_mc_func put_rv40_chroma_pixels_tab[3];
> +    h264_chroma_mc_func avg_rv40_chroma_pixels_tab[3];
> +} RV34DSPContext;
> +
> +void ff_rv30dsp_init(RV34DSPContext *c, DSPContext* dsp);
> +void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp);
> +
> +void ff_rv34dsp_init(RV34DSPContext *c, DSPContext *dsp);
> +void ff_rv34dsp_init_x86(RV34DSPContext *c, DSPContext *dsp);
> +
> +#endif /* AVCODEC_RV34DSP_H */
> diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c
> index 77f2002..fbe53c2 100644
> --- a/libavcodec/rv40dsp.c
> +++ b/libavcodec/rv40dsp.c
> @@ -26,6 +26,7 @@
>
>  #include "avcodec.h"
>  #include "dsputil.h"
> +#include "rv34dsp.h"
>
>  #define RV40_LOWPASS(OPNAME, OP) \
>  static av_unused void OPNAME ## rv40_qpel8_h_lowpass(uint8_t *dst, uint8_t 
> *src, int dstStride, int srcStride,\
> @@ -284,8 +285,8 @@ static void OPNAME ## rv40_chroma_mc8_c(uint8_t 
> *dst/*align 8*/, uint8_t *src/*a
>  RV40_CHROMA_MC(put_, op_put)
>  RV40_CHROMA_MC(avg_, op_avg)
>
> -void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx) {
> -    c->put_rv40_qpel_pixels_tab[0][ 0] = c->put_h264_qpel_pixels_tab[0][0];
> +void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp) {
> +    c->put_rv40_qpel_pixels_tab[0][ 0] = dsp->put_h264_qpel_pixels_tab[0][0];
>      c->put_rv40_qpel_pixels_tab[0][ 1] = put_rv40_qpel16_mc10_c;
>      c->put_rv40_qpel_pixels_tab[0][ 2] = put_rv40_qpel16_mc20_c;
>      c->put_rv40_qpel_pixels_tab[0][ 3] = put_rv40_qpel16_mc30_c;
> @@ -300,7 +301,7 @@ void ff_rv40dsp_init(DSPContext* c, AVCodecContext 
> *avctx) {
>      c->put_rv40_qpel_pixels_tab[0][12] = put_rv40_qpel16_mc03_c;
>      c->put_rv40_qpel_pixels_tab[0][13] = put_rv40_qpel16_mc13_c;
>      c->put_rv40_qpel_pixels_tab[0][14] = put_rv40_qpel16_mc23_c;
> -    c->avg_rv40_qpel_pixels_tab[0][ 0] = c->avg_h264_qpel_pixels_tab[0][0];
> +    c->avg_rv40_qpel_pixels_tab[0][ 0] = dsp->avg_h264_qpel_pixels_tab[0][0];
>      c->avg_rv40_qpel_pixels_tab[0][ 1] = avg_rv40_qpel16_mc10_c;
>      c->avg_rv40_qpel_pixels_tab[0][ 2] = avg_rv40_qpel16_mc20_c;
>      c->avg_rv40_qpel_pixels_tab[0][ 3] = avg_rv40_qpel16_mc30_c;
> @@ -315,7 +316,7 @@ void ff_rv40dsp_init(DSPContext* c, AVCodecContext 
> *avctx) {
>      c->avg_rv40_qpel_pixels_tab[0][12] = avg_rv40_qpel16_mc03_c;
>      c->avg_rv40_qpel_pixels_tab[0][13] = avg_rv40_qpel16_mc13_c;
>      c->avg_rv40_qpel_pixels_tab[0][14] = avg_rv40_qpel16_mc23_c;
> -    c->put_rv40_qpel_pixels_tab[1][ 0] = c->put_h264_qpel_pixels_tab[1][0];
> +    c->put_rv40_qpel_pixels_tab[1][ 0] = dsp->put_h264_qpel_pixels_tab[1][0];
>      c->put_rv40_qpel_pixels_tab[1][ 1] = put_rv40_qpel8_mc10_c;
>      c->put_rv40_qpel_pixels_tab[1][ 2] = put_rv40_qpel8_mc20_c;
>      c->put_rv40_qpel_pixels_tab[1][ 3] = put_rv40_qpel8_mc30_c;
> @@ -330,7 +331,7 @@ void ff_rv40dsp_init(DSPContext* c, AVCodecContext 
> *avctx) {
>      c->put_rv40_qpel_pixels_tab[1][12] = put_rv40_qpel8_mc03_c;
>      c->put_rv40_qpel_pixels_tab[1][13] = put_rv40_qpel8_mc13_c;
>      c->put_rv40_qpel_pixels_tab[1][14] = put_rv40_qpel8_mc23_c;
> -    c->avg_rv40_qpel_pixels_tab[1][ 0] = c->avg_h264_qpel_pixels_tab[1][0];
> +    c->avg_rv40_qpel_pixels_tab[1][ 0] = dsp->avg_h264_qpel_pixels_tab[1][0];
>      c->avg_rv40_qpel_pixels_tab[1][ 1] = avg_rv40_qpel8_mc10_c;
>      c->avg_rv40_qpel_pixels_tab[1][ 2] = avg_rv40_qpel8_mc20_c;
>      c->avg_rv40_qpel_pixels_tab[1][ 3] = avg_rv40_qpel8_mc30_c;
> diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
> index d3cf0da..d85267b 100644
> --- a/libavcodec/x86/Makefile
> +++ b/libavcodec/x86/Makefile
> @@ -21,6 +21,10 @@ YASM-OBJS-$(CONFIG_H264PRED)           += 
> x86/h264_intrapred.o          \
>                                            x86/h264_intrapred_10bit.o
>  MMX-OBJS-$(CONFIG_H264PRED)            += x86/h264_intrapred_init.o
>
> +YASM-OBJS-$(CONFIG_RV30_DECODER)       += x86/rv34dsp.o                 \
> +
> +YASM-OBJS-$(CONFIG_RV40_DECODER)       += x86/rv34dsp.o                 \
> +
>  YASM-OBJS-$(CONFIG_VC1_DECODER)        += x86/vc1dsp_yasm.o
>
>  MMX-OBJS-$(CONFIG_AC3DSP)              += x86/ac3dsp_mmx.o
> diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
> index 9909fda..0cd9601 100644
> --- a/libavcodec/x86/dsputil_mmx.c
> +++ b/libavcodec/x86/dsputil_mmx.c
> @@ -1895,29 +1895,17 @@ PREFETCH(prefetch_3dnow, prefetch)
>
>  void ff_put_h264_chroma_mc8_mmx_rnd   (uint8_t *dst, uint8_t *src,
>                                         int stride, int h, int x, int y);
> -void ff_put_rv40_chroma_mc8_mmx       (uint8_t *dst, uint8_t *src,
> -                                       int stride, int h, int x, int y);
>  void ff_avg_h264_chroma_mc8_mmx2_rnd  (uint8_t *dst, uint8_t *src,
>                                         int stride, int h, int x, int y);
> -void ff_avg_rv40_chroma_mc8_mmx2      (uint8_t *dst, uint8_t *src,
> -                                       int stride, int h, int x, int y);
>  void ff_avg_h264_chroma_mc8_3dnow_rnd (uint8_t *dst, uint8_t *src,
>                                         int stride, int h, int x, int y);
> -void ff_avg_rv40_chroma_mc8_3dnow     (uint8_t *dst, uint8_t *src,
> -                                       int stride, int h, int x, int y);
>
>  void ff_put_h264_chroma_mc4_mmx       (uint8_t *dst, uint8_t *src,
>                                         int stride, int h, int x, int y);
> -void ff_put_rv40_chroma_mc4_mmx       (uint8_t *dst, uint8_t *src,
> -                                       int stride, int h, int x, int y);
>  void ff_avg_h264_chroma_mc4_mmx2      (uint8_t *dst, uint8_t *src,
>                                         int stride, int h, int x, int y);
> -void ff_avg_rv40_chroma_mc4_mmx2      (uint8_t *dst, uint8_t *src,
> -                                       int stride, int h, int x, int y);
>  void ff_avg_h264_chroma_mc4_3dnow     (uint8_t *dst, uint8_t *src,
>                                         int stride, int h, int x, int y);
> -void ff_avg_rv40_chroma_mc4_3dnow     (uint8_t *dst, uint8_t *src,
> -                                       int stride, int h, int x, int y);
>
>  void ff_put_h264_chroma_mc2_mmx2      (uint8_t *dst, uint8_t *src,
>                                         int stride, int h, int x, int y);
> @@ -2573,9 +2561,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext 
> *avctx)
>          c->put_h264_chroma_pixels_tab[1]= ff_put_h264_chroma_mc4_mmx;
>          }
>
> -        c->put_rv40_chroma_pixels_tab[0]= ff_put_rv40_chroma_mc8_mmx;
> -        c->put_rv40_chroma_pixels_tab[1]= ff_put_rv40_chroma_mc4_mmx;
> -
>          c->vector_clip_int32 = ff_vector_clip_int32_mmx;
>  #endif
>
> @@ -2675,9 +2660,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext 
> *avctx)
>              SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, mmx2, );
>
>  #if HAVE_YASM
> -            c->avg_rv40_chroma_pixels_tab[0]= ff_avg_rv40_chroma_mc8_mmx2;
> -            c->avg_rv40_chroma_pixels_tab[1]= ff_avg_rv40_chroma_mc4_mmx2;
> -
>              if (!high_bit_depth) {
>              c->avg_h264_chroma_pixels_tab[0]= 
> ff_avg_h264_chroma_mc8_mmx2_rnd;
>              c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_mmx2;
> @@ -2760,8 +2742,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext 
> *avctx)
>              c->avg_h264_chroma_pixels_tab[1]= ff_avg_h264_chroma_mc4_3dnow;
>              }
>
> -            c->avg_rv40_chroma_pixels_tab[0]= ff_avg_rv40_chroma_mc8_3dnow;
> -            c->avg_rv40_chroma_pixels_tab[1]= ff_avg_rv40_chroma_mc4_3dnow;
>  #endif
>          }
>
> diff --git a/libavcodec/x86/rv34dsp.c b/libavcodec/x86/rv34dsp.c
> new file mode 100644
> index 0000000..4be1bbc
> --- /dev/null
> +++ b/libavcodec/x86/rv34dsp.c
> @@ -0,0 +1,59 @@
> +/*
> + * RV30/40 decoder motion compensation functions x86-optimised
> + * Copyright (c) 2008 Konstantin Shishkov
> + *
> + * 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
> + */
> +
> +/**
> + * @file
> + * RV30/40 decoder motion compensation functions
> + */
> +
> +#include "libavcodec/rv34dsp.h"
> +
> +void ff_put_rv40_chroma_mc8_mmx  (uint8_t *dst, uint8_t *src,
> +                                  int stride, int h, int x, int y);
> +void ff_avg_rv40_chroma_mc8_mmx2 (uint8_t *dst, uint8_t *src,
> +                                  int stride, int h, int x, int y);
> +void ff_avg_rv40_chroma_mc8_3dnow(uint8_t *dst, uint8_t *src,
> +                                  int stride, int h, int x, int y);
> +
> +void ff_put_rv40_chroma_mc4_mmx  (uint8_t *dst, uint8_t *src,
> +                                  int stride, int h, int x, int y);
> +void ff_avg_rv40_chroma_mc4_mmx2 (uint8_t *dst, uint8_t *src,
> +                                  int stride, int h, int x, int y);
> +void ff_avg_rv40_chroma_mc4_3dnow(uint8_t *dst, uint8_t *src,
> +                                  int stride, int h, int x, int y);
> +
> +void ff_rv34dsp_init_x86(RV34DSPContext *c, DSPContext *dsp)
> +{
> +    av_unused int mm_flags = av_get_cpu_flags();
> +
> +#if HAVE_YASM
> +    c->put_rv40_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_mmx;
> +    c->put_rv40_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_mmx;
> +    if (mm_flags & AV_CPU_FLAG_MMX2) {
> +        c->avg_rv40_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_mmx2;
> +        c->avg_rv40_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_mmx2;
> +    } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
> +        c->avg_rv40_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_3dnow;
> +        c->avg_rv40_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_3dnow;
> +    }
> +#endif
> +}
> +
> -- 
> 1.7.0.4
>

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to