[FFmpeg-devel] [PATCH] Move cavs dsp functions to their own struct

Michael Niedermayer michaelni
Tue Aug 3 17:35:49 CEST 2010


On Tue, Aug 03, 2010 at 12:13:16AM +0100, Mans Rullgard wrote:
> ---
>  libavcodec/cavs.c            |   37 +++++++++++++++++++------------------
>  libavcodec/cavs.h            |    2 ++
>  libavcodec/cavsdec.c         |    2 +-
>  libavcodec/cavsdsp.c         |    5 ++++-
>  libavcodec/cavsdsp.h         |   41 +++++++++++++++++++++++++++++++++++++++++
>  libavcodec/dsputil.c         |    4 ----
>  libavcodec/dsputil.h         |   10 ----------
>  libavcodec/x86/cavsdsp_mmx.c |   13 +++++++++++--
>  libavcodec/x86/dsputil_mmx.c |    6 ------
>  libavcodec/x86/dsputil_mmx.h |    2 --
>  10 files changed, 78 insertions(+), 44 deletions(-)
>  create mode 100644 libavcodec/cavsdsp.h
> 
> diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
> index ff6c869..5f9f5ee 100644
> --- a/libavcodec/cavs.c
> +++ b/libavcodec/cavs.c
> @@ -113,22 +113,22 @@ void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) {
>              if(h->flags & A_AVAIL) {
>                  qp_avg = (h->qp + h->left_qp + 1) >> 1;
>                  SET_PARAMS;
> -                h->s.dsp.cavs_filter_lv(h->cy,h->l_stride,alpha,beta,tc,bs[0],bs[1]);
> -                h->s.dsp.cavs_filter_cv(h->cu,h->c_stride,alpha,beta,tc,bs[0],bs[1]);
> -                h->s.dsp.cavs_filter_cv(h->cv,h->c_stride,alpha,beta,tc,bs[0],bs[1]);
> +                h->dsp.cavs_filter_lv(h->cy,h->l_stride,alpha,beta,tc,bs[0],bs[1]);
> +                h->dsp.cavs_filter_cv(h->cu,h->c_stride,alpha,beta,tc,bs[0],bs[1]);
> +                h->dsp.cavs_filter_cv(h->cv,h->c_stride,alpha,beta,tc,bs[0],bs[1]);
>              }
>              qp_avg = h->qp;
>              SET_PARAMS;
> -            h->s.dsp.cavs_filter_lv(h->cy + 8,h->l_stride,alpha,beta,tc,bs[2],bs[3]);
> -            h->s.dsp.cavs_filter_lh(h->cy + 8*h->l_stride,h->l_stride,alpha,beta,tc,
> +            h->dsp.cavs_filter_lv(h->cy + 8,h->l_stride,alpha,beta,tc,bs[2],bs[3]);
> +            h->dsp.cavs_filter_lh(h->cy + 8*h->l_stride,h->l_stride,alpha,beta,tc,
>                             bs[6],bs[7]);
>  
>              if(h->flags & B_AVAIL) {
>                  qp_avg = (h->qp + h->top_qp[h->mbx] + 1) >> 1;
>                  SET_PARAMS;
> -                h->s.dsp.cavs_filter_lh(h->cy,h->l_stride,alpha,beta,tc,bs[4],bs[5]);
> -                h->s.dsp.cavs_filter_ch(h->cu,h->c_stride,alpha,beta,tc,bs[4],bs[5]);
> -                h->s.dsp.cavs_filter_ch(h->cv,h->c_stride,alpha,beta,tc,bs[4],bs[5]);
> +                h->dsp.cavs_filter_lh(h->cy,h->l_stride,alpha,beta,tc,bs[4],bs[5]);
> +                h->dsp.cavs_filter_ch(h->cu,h->c_stride,alpha,beta,tc,bs[4],bs[5]);
> +                h->dsp.cavs_filter_ch(h->cv,h->c_stride,alpha,beta,tc,bs[4],bs[5]);
>              }
>          }
>      }
> @@ -414,30 +414,30 @@ static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int de
>  void ff_cavs_inter(AVSContext *h, enum cavs_mb mb_type) {
>      if(ff_cavs_partition_flags[mb_type] == 0){ // 16x16
>          mc_part_std(h, 1, 8, 0, h->cy, h->cu, h->cv, 0, 0,
> -                h->s.dsp.put_cavs_qpel_pixels_tab[0],
> +                h->dsp.put_cavs_qpel_pixels_tab[0],
>                  h->s.dsp.put_h264_chroma_pixels_tab[0],
> -                h->s.dsp.avg_cavs_qpel_pixels_tab[0],
> +                h->dsp.avg_cavs_qpel_pixels_tab[0],
>                  h->s.dsp.avg_h264_chroma_pixels_tab[0],&h->mv[MV_FWD_X0]);
>      }else{
>          mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 0,
> -                h->s.dsp.put_cavs_qpel_pixels_tab[1],
> +                h->dsp.put_cavs_qpel_pixels_tab[1],
>                  h->s.dsp.put_h264_chroma_pixels_tab[1],
> -                h->s.dsp.avg_cavs_qpel_pixels_tab[1],
> +                h->dsp.avg_cavs_qpel_pixels_tab[1],
>                  h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X0]);
>          mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 0,
> -                h->s.dsp.put_cavs_qpel_pixels_tab[1],
> +                h->dsp.put_cavs_qpel_pixels_tab[1],
>                  h->s.dsp.put_h264_chroma_pixels_tab[1],
> -                h->s.dsp.avg_cavs_qpel_pixels_tab[1],
> +                h->dsp.avg_cavs_qpel_pixels_tab[1],
>                  h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X1]);
>          mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 4,
> -                h->s.dsp.put_cavs_qpel_pixels_tab[1],
> +                h->dsp.put_cavs_qpel_pixels_tab[1],
>                  h->s.dsp.put_h264_chroma_pixels_tab[1],
> -                h->s.dsp.avg_cavs_qpel_pixels_tab[1],
> +                h->dsp.avg_cavs_qpel_pixels_tab[1],
>                  h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X2]);
>          mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 4,
> -                h->s.dsp.put_cavs_qpel_pixels_tab[1],
> +                h->dsp.put_cavs_qpel_pixels_tab[1],
>                  h->s.dsp.put_h264_chroma_pixels_tab[1],
> -                h->s.dsp.avg_cavs_qpel_pixels_tab[1],
> +                h->dsp.avg_cavs_qpel_pixels_tab[1],
>                  h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X3]);
>      }
>  }
> @@ -672,6 +672,7 @@ av_cold int ff_cavs_init(AVCodecContext *avctx) {
>      MpegEncContext * const s = &h->s;
>  
>      MPV_decode_defaults(s);
> +    ff_cavsdsp_init(&h->dsp, avctx);
>      s->avctx = avctx;
>  
>      avctx->pix_fmt= PIX_FMT_YUV420P;
> diff --git a/libavcodec/cavs.h b/libavcodec/cavs.h
> index 729c83e..c80fd32 100644
> --- a/libavcodec/cavs.h
> +++ b/libavcodec/cavs.h
> @@ -24,6 +24,7 @@
>  
>  #include "dsputil.h"
>  #include "mpegvideo.h"
> +#include "cavsdsp.h"
>  
>  #define SLICE_MAX_START_CODE    0x000001af
>  #define EXT_START_CODE          0x000001b5
> @@ -153,6 +154,7 @@ struct dec_2dvlc {
>  
>  typedef struct {
>      MpegEncContext s;
> +    CAVSDSPContext dsp;

i would slightly prefer it not to be called plain dsp so it wont be confused with
DSPContext

otherwise ok as far as i maintain it

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100803/e1194f5f/attachment.pgp>



More information about the ffmpeg-devel mailing list