]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit 'bf6b3ec924b4fb64d14df33077f4d4541d525dbf'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 9 Feb 2013 13:01:40 +0000 (14:01 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 9 Feb 2013 13:22:05 +0000 (14:22 +0100)
* commit 'bf6b3ec924b4fb64d14df33077f4d4541d525dbf':
  dsputil: Move rnd_avg inline functions to a separate header

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/bit_depth_template.c
libavcodec/dsputil.h
libavcodec/sh4/dsputil_align.c
libavcodec/sh4/qpel.c
libavcodec/vc1dsp.c
libavcodec/vp3dsp.c

index 6b757fc04167dfe69760a70f09dc2b516b3959f2,294b3bbfd253e951cc24cb1045ad3ad46920700d..66b737bd8e1cdd9ca1348ac8b296f43bb0aea3c3
@@@ -17,6 -17,7 +17,7 @@@
   */
  
  #include "dsputil.h"
+ #include "rnd_avg.h"
  
  #ifndef BIT_DEPTH
  #define BIT_DEPTH 8
@@@ -70,7 -71,7 +71,7 @@@
  #   define pixel4 uint32_t
  #   define dctcoef int16_t
  
 -#   define INIT_CLIP uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
 +#   define INIT_CLIP
  #   define no_rnd_avg_pixel4 no_rnd_avg32
  #   define    rnd_avg_pixel4    rnd_avg32
  #   define AV_RN2P  AV_RN16
@@@ -82,7 -83,7 +83,7 @@@
  #   define PIXEL_SPLAT_X4(x) ((x)*0x01010101U)
  
  #   define av_clip_pixel(a) av_clip_uint8(a)
 -#   define CLIP(a) cm[a]
 +#   define CLIP(a) av_clip_uint8(a)
  #endif
  
  #define FUNC3(a, b, c)  a ## _ ## b ## c
diff --combined libavcodec/dsputil.h
index 3a0a610f323bbeb2f9d07325d8af2c756f4add76,70e2489d32620f61d104977d28722bade9b278c8..e5f0e31f250879c97e9a3a3c453a528b1b1dc00b
@@@ -3,20 -3,20 +3,20 @@@
   * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
   * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
   *
 - * This file is part of Libav.
 + * This file is part of FFmpeg.
   *
 - * Libav is free software; you can redistribute it and/or
 + * FFmpeg 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,
 + * FFmpeg 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
 + * License along with FFmpeg; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   */
  
@@@ -45,9 -45,6 +45,9 @@@ void ff_fdct248_islow_8(int16_t *data)
  void ff_fdct248_islow_10(int16_t *data);
  
  void ff_j_rev_dct(int16_t *data);
 +void ff_j_rev_dct4(int16_t *data);
 +void ff_j_rev_dct2(int16_t *data);
 +void ff_j_rev_dct1(int16_t *data);
  
  void ff_fdct_mmx(int16_t *block);
  void ff_fdct_mmxext(int16_t *block);
@@@ -75,8 -72,6 +75,8 @@@ void ff_avg_pixels16x16_ ## depth ## _c
  PUTAVG_PIXELS( 8)
  PUTAVG_PIXELS( 9)
  PUTAVG_PIXELS(10)
 +PUTAVG_PIXELS(12)
 +PUTAVG_PIXELS(14)
  
  #define ff_put_pixels8x8_c ff_put_pixels8x8_8_c
  #define ff_avg_pixels8x8_c ff_avg_pixels8x8_8_c
@@@ -95,7 -90,7 +95,7 @@@ void ff_gmc_c(uint8_t *dst, uint8_t *sr
  /* minimum alignment rules ;)
  If you notice errors in the align stuff, need more alignment for some ASM code
  for some CPU or need to use a function with less aligned data then send a mail
 -to the libav-devel mailing list, ...
 +to the ffmpeg-devel mailing list, ...
  
  !warning These alignments might not match reality, (missing attribute((align))
  stuff somewhere possible).
@@@ -133,7 -128,7 +133,7 @@@ DEF_OLD_QPEL(qpel8_mc13_old_c
  DEF_OLD_QPEL(qpel8_mc33_old_c)
  
  #define CALL_2X_PIXELS(a, b, n)\
 -static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
 +static void a(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\
      b(block  , pixels  , line_size, h);\
      b(block+n, pixels+n, line_size, h);\
  }
@@@ -156,14 -151,6 +156,14 @@@ void ff_init_scantable(uint8_t *, ScanT
  void ff_init_scantable_permutation(uint8_t *idct_permutation,
                                     int idct_permutation_type);
  
 +#define EMULATED_EDGE(depth) \
 +void ff_emulated_edge_mc_ ## depth (uint8_t *buf, const uint8_t *src, ptrdiff_t linesize,\
 +                         int block_w, int block_h,\
 +                         int src_x, int src_y, int w, int h);
 +
 +EMULATED_EDGE(8)
 +EMULATED_EDGE(16)
 +
  /**
   * DSPContext.
   */
@@@ -207,8 -194,6 +207,8 @@@ typedef struct DSPContext 
      me_cmp_func vsad[6];
      me_cmp_func vsse[6];
      me_cmp_func nsse[6];
 +    me_cmp_func w53[6];
 +    me_cmp_func w97[6];
      me_cmp_func dct_max[6];
      me_cmp_func dct264_sad[6];
  
       * @param line_size number of bytes in a horizontal line of block
       * @param h height
       */
 -    op_pixels_func put_no_rnd_pixels_tab[2][4];
 +    op_pixels_func put_no_rnd_pixels_tab[4][4];
  
      /**
       * Halfpel motion compensation with no rounding (a+b)>>1.
  
      /* huffyuv specific */
      void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w);
 -    void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 1*/,int w);
 +    void (*diff_bytes)(uint8_t *dst/*align 16*/, const uint8_t *src1/*align 16*/, const uint8_t *src2/*align 1*/,int w);
      /**
       * subtract huffyuv's variant of median prediction
       * note, this might read from src1[-1], src2[-1]
      void (*add_hfyu_median_prediction)(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top);
      int  (*add_hfyu_left_prediction)(uint8_t *dst, const uint8_t *src, int w, int left);
      void (*add_hfyu_left_prediction_bgr32)(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha);
 +    /* this might write to dst[w] */
      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 ff_dsputil_static_init(void);
  void ff_dsputil_init(DSPContext* p, AVCodecContext *avctx);
 +attribute_deprecated void dsputil_init(DSPContext* c, AVCodecContext *avctx);
  
  int ff_check_alignment(void);
  
  void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);
  
- #define         BYTE_VEC32(c)   ((c)*0x01010101UL)
- #define         BYTE_VEC64(c)   ((c)*0x0001000100010001UL)
- static inline uint32_t rnd_avg32(uint32_t a, uint32_t b)
- {
-     return (a | b) - (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
- }
- static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
- {
-     return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
- }
- static inline uint64_t rnd_avg64(uint64_t a, uint64_t b)
- {
-     return (a | b) - (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
- }
- static inline uint64_t no_rnd_avg64(uint64_t a, uint64_t b)
- {
-     return (a & b) + (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
- }
  void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
  void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
  void ff_dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
@@@ -451,8 -411,6 +428,8 @@@ void ff_dsputil_init_ppc(DSPContext* c
  void ff_dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
  void ff_dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
  
 +void ff_dsputil_init_dwt(DSPContext *c);
 +
  #if (ARCH_ARM && HAVE_NEON) || ARCH_PPC || HAVE_MMX
  #   define STRIDE_ALIGN 16
  #else
index d59a12ec56f1869df68c5c22e1a65e7e059e7a06,5c3e65ba00ed17865a8f8ddb27a0ffae38d49a82..46981f6c87ea7a63de11696c06de6f2ad9d27fff
@@@ -3,26 -3,27 +3,27 @@@
   *
   * Copyright (c) 2001-2003 BERO <bero@geocities.co.jp>
   *
 - * This file is part of Libav.
 + * This file is part of FFmpeg.
   *
 - * Libav is free software; you can redistribute it and/or
 + * FFmpeg 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,
 + * FFmpeg 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
 + * License along with FFmpeg; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   */
  
  #include "libavutil/attributes.h"
  #include "libavcodec/avcodec.h"
  #include "libavcodec/dsputil.h"
+ #include "libavcodec/rnd_avg.h"
  #include "dsputil_sh4.h"
  
  
diff --combined libavcodec/sh4/qpel.c
index 8bcce2b8d2c49289b7a925c29078813a32301fb5,5fa41415389fff9a2d53c903b7e40857ec13e2e2..1a5a4cd88d3f1562d9a0bc7ef7e0692c5739489a
@@@ -4,25 -4,26 +4,26 @@@
   *
   * copyright (c) 2001-2003 BERO <bero@geocities.co.jp>
   *
 - * This file is part of Libav.
 + * This file is part of FFmpeg.
   *
 - * Libav is free software; you can redistribute it and/or
 + * FFmpeg 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,
 + * FFmpeg 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
 + * License along with FFmpeg; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   */
  
  #include "libavutil/common.h"
  #include "libavcodec/copy_block.h"
+ #include "libavcodec/rnd_avg.h"
  
  #define PIXOP2(OPNAME, OP) \
  \
diff --combined libavcodec/vc1dsp.c
index 7ad63afd7842513620c13033c9d79c0b5042502b,99ede18df79265cb2f401a5508ef605648053307..260eda401bf5bdcb3baaac0c2e04b436a6dbe788
@@@ -2,20 -2,20 +2,20 @@@
   * VC-1 and WMV3 decoder - DSP functions
   * Copyright (c) 2006 Konstantin Shishkov
   *
 - * This file is part of Libav.
 + * This file is part of FFmpeg.
   *
 - * Libav is free software; you can redistribute it and/or
 + * FFmpeg 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,
 + * FFmpeg 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
 + * License along with FFmpeg; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   */
  
   *
   */
  
 +#include "libavutil/avassert.h"
  #include "libavutil/common.h"
  #include "h264chroma.h"
++#include "rnd_avg.h"
  #include "vc1dsp.h"
  
  
@@@ -563,7 -562,7 +564,7 @@@ static av_always_inline int vc1_mspel_f
  
  /** Function used to do motion compensation with bicubic interpolation
   */
 -#define VC1_MSPEL_MC(OP, OPNAME)\
 +#define VC1_MSPEL_MC(OP, OP4, OPNAME)\
  static av_always_inline void OPNAME ## vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int hmode, int vmode, int rnd)\
  {\
      int     i, j;\
          dst += stride;\
          src += stride;\
      }\
 +}\
 +static void OPNAME ## pixels8x8_c(uint8_t *block, const uint8_t *pixels, int line_size, int rnd){\
 +    int i;\
 +    for(i=0; i<8; i++){\
 +        OP4(*(uint32_t*)(block  ), AV_RN32(pixels  ));\
 +        OP4(*(uint32_t*)(block+4), AV_RN32(pixels+4));\
 +        pixels+=line_size;\
 +        block +=line_size;\
 +    }\
  }
  
  #define op_put(a, b) a = av_clip_uint8(b)
  #define op_avg(a, b) a = (a + av_clip_uint8(b) + 1) >> 1
 +#define op4_avg(a, b) a = rnd_avg32(a, b)
 +#define op4_put(a, b) a = b
  
 -VC1_MSPEL_MC(op_put, put_)
 -VC1_MSPEL_MC(op_avg, avg_)
 +VC1_MSPEL_MC(op_put, op4_put, put_)
 +VC1_MSPEL_MC(op_avg, op4_avg, avg_)
  
  /* pixel functions - really are entry points to vc1_mspel_mc */
  
@@@ -672,7 -660,7 +673,7 @@@ static void put_no_rnd_vc1_chroma_mc8_c
      const int D=(  x)*(  y);
      int i;
  
 -    assert(x<8 && y<8 && x>=0 && y>=0);
 +    av_assert2(x<8 && y<8 && x>=0 && y>=0);
  
      for(i=0; i<h; i++)
      {
@@@ -696,7 -684,7 +697,7 @@@ static void put_no_rnd_vc1_chroma_mc4_c
      const int D=(  x)*(  y);
      int i;
  
 -    assert(x<8 && y<8 && x>=0 && y>=0);
 +    av_assert2(x<8 && y<8 && x>=0 && y>=0);
  
      for(i=0; i<h; i++)
      {
@@@ -717,7 -705,7 +718,7 @@@ static void avg_no_rnd_vc1_chroma_mc8_c
      const int D=(  x)*(  y);
      int i;
  
 -    assert(x<8 && y<8 && x>=0 && y>=0);
 +    av_assert2(x<8 && y<8 && x>=0 && y>=0);
  
      for(i=0; i<h; i++)
      {
@@@ -814,7 -802,7 +815,7 @@@ av_cold void ff_vc1dsp_init(VC1DSPConte
      dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_c;
      dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_c;
  
 -    dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_pixels8x8_c;
 +    dsp->put_vc1_mspel_pixels_tab[ 0] = put_pixels8x8_c;
      dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_c;
      dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_c;
      dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_c;
      dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_c;
      dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_c;
  
 -    dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_pixels8x8_c;
 +    dsp->avg_vc1_mspel_pixels_tab[ 0] = avg_pixels8x8_c;
      dsp->avg_vc1_mspel_pixels_tab[ 1] = avg_vc1_mspel_mc10_c;
      dsp->avg_vc1_mspel_pixels_tab[ 2] = avg_vc1_mspel_mc20_c;
      dsp->avg_vc1_mspel_pixels_tab[ 3] = avg_vc1_mspel_mc30_c;
diff --combined libavcodec/vp3dsp.c
index f3f9bd231d58f0a36c1c4ecf08e8f0deda90e676,d1a7db957d4482dbb3df0beac455cc69e305c087..051812e72d409b1cfa59d8055e3e6435f8cacee9
@@@ -1,20 -1,20 +1,20 @@@
  /*
   * Copyright (C) 2004 the ffmpeg project
   *
 - * This file is part of Libav.
 + * This file is part of FFmpeg.
   *
 - * Libav is free software; you can redistribute it and/or
 + * FFmpeg 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,
 + * FFmpeg 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
 + * License along with FFmpeg; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   */
  
@@@ -28,6 -28,7 +28,7 @@@
  #include "libavutil/common.h"
  #include "avcodec.h"
  #include "dsputil.h"
+ #include "rnd_avg.h"
  #include "vp3dsp.h"
  
  #define IdctAdjustBeforeShift 8