Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 4 Aug 2012 20:39:25 +0000 (22:39 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 4 Aug 2012 21:51:43 +0000 (23:51 +0200)
* qatar/master:
  lavr: fix handling of custom mix matrices
  fate: force pix_fmt in lagarith-rgb32 test
  fate: add tests for lagarith lossless video codec.
  ARMv6: vp8: fix stack allocation with Apple's assembler
  ARM: vp56: allow inline asm to build with clang
  fft: 3dnow: fix register name typo in DECL_IMDCT macro
  x86: dct32: port to cpuflags
  x86: build: replace mmx2 by mmxext
  Revert "wmapro: prevent division by zero when sample rate is unspecified"
  wmapro: prevent division by zero when sample rate is unspecified
  lagarith: fix color plane inversion for YUY2 output.
  lagarith: pad RGB buffer by 1 byte.
  dsputil: make add_hfyu_left_prediction_sse4() support unaligned src.

Conflicts:
doc/APIchanges
libavcodec/lagarith.c
libavfilter/x86/gradfun.c
libavutil/cpu.h
libavutil/version.h
libswscale/utils.c
libswscale/version.h
libswscale/x86/yuv2rgb.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
44 files changed:
1  2 
Doxyfile
configure
doc/APIchanges
libavcodec/arm/vp56_arith.h
libavcodec/dct-test.c
libavcodec/motion-test.c
libavcodec/x86/ac3dsp.asm
libavcodec/x86/ac3dsp_mmx.c
libavcodec/x86/cavsdsp_mmx.c
libavcodec/x86/dct32_sse.asm
libavcodec/x86/dsputil_mmx.c
libavcodec/x86/dsputil_yasm.asm
libavcodec/x86/dsputilenc_mmx.c
libavcodec/x86/fft_mmx.asm
libavcodec/x86/h264_intrapred_init.c
libavcodec/x86/h264dsp_mmx.c
libavcodec/x86/motion_est_mmx.c
libavcodec/x86/mpegvideo_mmx.c
libavcodec/x86/mpegvideo_mmx_template.c
libavcodec/x86/pngdsp-init.c
libavcodec/x86/rv40dsp_init.c
libavcodec/x86/snowdsp_mmx.c
libavcodec/x86/vc1dsp_mmx.c
libavcodec/x86/vp3dsp_init.c
libavcodec/x86/vp8dsp-init.c
libavfilter/x86/gradfun.c
libavfilter/x86/yadif.c
libavresample/utils.c
libavutil/cpu.c
libavutil/cpu.h
libavutil/utils.c
libavutil/version.h
libavutil/x86/cpu.c
libswscale/swscale.c
libswscale/swscale.h
libswscale/utils.c
libswscale/version.h
libswscale/x86/rgb2rgb.c
libswscale/x86/rgb2rgb_template.c
libswscale/x86/swscale.c
libswscale/x86/swscale_template.c
libswscale/x86/yuv2rgb.c
libswscale/x86/yuv2rgb_template.c
tests/fate/lossless-video.mak

diff --cc Doxyfile
Simple merge
diff --cc configure
+++ b/configure
@@@ -4019,11 -3522,8 +4019,12 @@@ cat > $TMPH <<EO
  #define EXTERN_PREFIX "${extern_prefix}"
  #define EXTERN_ASM ${extern_prefix}
  #define SLIBSUF "$SLIBSUF"
++#define HAVE_MMX2 HAVE_MMXEXT
  EOF
  
 +test -n "$assert_level" &&
 +    echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
 +
  test -n "$malloc_prefix" &&
      echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  
diff --cc doc/APIchanges
@@@ -15,61 -13,11 +15,66 @@@ libavutil:     2011-04-1
  
  API changes, most recent first:
  
 +2012-07-31 - xxxxxxx - lavc 54.46.100
 +  Add channels field to AVFrame.
 +
 +2012-07-30 - xxxxxxx - lavu 51.66.100
 +  Add av_get_channel_description()
 +  and av_get_standard_channel_layout() functions.
 +
 +2012-07-20 - xxxxxxx - lavc 54.43.100
 +  Add decode_error_flags field to AVFrame.
 +
 +2012-07-20 - xxxxxxx - lavf 54.18.100
 +  Add avformat_match_stream_specifier() function.
 +
 +2012-07-14 - xxxxxxx - lavc 54.38.100 - avcodec.h
 +  Add metadata to AVFrame, and the accessor functions
 +  av_frame_get_metadata() and av_frame_set_metadata().
 +
 +2012-07-10 - xxxxxxx - lavc 54.33.100
 +  Add av_fast_padded_mallocz().
 +
 +2012-07-10 - xxxxxxx - lavfi 3.2.0 - avfilter.h
 +  Add init_opaque() callback to AVFilter struct.
 +
 +2012-06-26 - xxxxxxx - lavu 51.63.100 - imgutils.h
 +  Add functions to libavutil/imgutils.h:
 +  av_image_get_buffer_size()
 +  av_image_fill_arrays()
 +  av_image_copy_to_buffer()
 +
 +2012-06-24 - xxxxxxx - lavu 51.62.100 - version.h
 +  version moved from avutil.h to version.h
 +
 +2012-04-11 - xxxxxxx - lavu 51.58.100 - error.h
 +  Add av_make_error_string() and av_err2str() utilities to
 +  libavutil/error.h.
 +
 +2012-06-05 - xxxxxxx - lavc 54.24.100
 +  Add pkt_duration field to AVFrame.
 +
 +2012-05-24 - xxxxxxx - lavu 51.54.100
 +  Move AVPALETTE_SIZE and AVPALETTE_COUNT macros from
 +  libavcodec/avcodec.h to libavutil/pixfmt.h.
 +
 +2012-05-07 - xxxxxxx - lavf 54.5.100
 +  Add av_guess_sample_aspect_ratio() function.
 +
 +2012-04-20 - xxxxxxx - lavfi 2.70.100
 +  Add avfilter_unref_bufferp() to avfilter.h.
 +
 +2012-04-12 - xxxxxxx - lavfi 2.68.100
 +  Install libavfilter/asrc_abuffer.h public header.
 +
 +2012-03-26 - a67d9cf - lavfi 2.66.100
 +  Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
 +
+ 2012-08-03 - xxxxxxx - lavu 51.37.1 - cpu.h
+                        lsws 2.1.1   - swscale.h
+   Rename AV_CPU_FLAG_MMX2  ---> AV_CPU_FLAG_MMXEXT.
+   Rename SWS_CPU_CAPS_MMX2 ---> SWS_CPU_CAPS_MMXEXT.
  2012-07-xx - xxxxxxx - lavf 54.13.0 - avformat.h
    Add AVFMT_FLAG_NOBUFFER for low latency use cases.
  
Simple merge
@@@ -126,17 -109,10 +126,17 @@@ static const struct algo idct_tab[] = 
      { "SIMPLE-C",       ff_simple_idct_8,      NO_PERM  },
  
  #if HAVE_MMX && HAVE_INLINE_ASM
 +#if CONFIG_GPL
 +    { "LIBMPEG2-MMX",   ff_mmx_idct,           MMX_PERM,  AV_CPU_FLAG_MMX,  1 },
 +    { "LIBMPEG2-MMX2",  ff_mmxext_idct,        MMX_PERM,  AV_CPU_FLAG_MMX2, 1 },
 +#endif
      { "SIMPLE-MMX",     ff_simple_idct_mmx,  MMX_SIMPLE_PERM, AV_CPU_FLAG_MMX },
      { "XVID-MMX",       ff_idct_xvid_mmx,      NO_PERM,   AV_CPU_FLAG_MMX,  1 },
-     { "XVID-MMX2",      ff_idct_xvid_mmx2,     NO_PERM,   AV_CPU_FLAG_MMX2, 1 },
+     { "XVID-MMXEXT",    ff_idct_xvid_mmx2,     NO_PERM,   AV_CPU_FLAG_MMXEXT, 1 },
      { "XVID-SSE2",      ff_idct_xvid_sse2,     SSE2_PERM, AV_CPU_FLAG_SSE2, 1 },
 +#if ARCH_X86_64 && HAVE_YASM
 +    { "PR-SSE2",        ff_prores_idct_put_10_sse2_wrap,     TRANSPOSE_PERM, AV_CPU_FLAG_SSE2, 1 },
 +#endif
  #endif
  
  #if ARCH_BFIN
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -755,12 -755,9 +755,12 @@@ void ff_vc1dsp_init_mmx(VC1DSPContext *
          dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx;
          dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx;
          dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx;
 +
 +        if (HAVE_YASM)
 +            dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd;
      }
  
-     if (mm_flags & AV_CPU_FLAG_MMX2){
+     if (mm_flags & AV_CPU_FLAG_MMXEXT) {
          dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2;
          dsp->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_mmx2;
          dsp->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_mmx2;
  
  #if HAVE_YASM
      if (mm_flags & AV_CPU_FLAG_MMX) {
 -        dsp->put_no_rnd_vc1_chroma_pixels_tab[0]= ff_put_vc1_chroma_mc8_mmx_nornd;
      }
  
-     if (mm_flags & AV_CPU_FLAG_MMX2) {
+     if (mm_flags & AV_CPU_FLAG_MMXEXT) {
          ASSIGN_LF(mmx2);
 -        dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_mmx2_nornd;
 -    } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
 -        dsp->avg_no_rnd_vc1_chroma_pixels_tab[0]= ff_avg_vc1_chroma_mc8_3dnow_nornd;
      }
  
      if (mm_flags & AV_CPU_FLAG_SSE2) {
Simple merge
Simple merge
@@@ -28,8 -28,8 +28,8 @@@
  DECLARE_ALIGNED(16, static const uint16_t, pw_7f)[8] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F};
  DECLARE_ALIGNED(16, static const uint16_t, pw_ff)[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
  
- #if HAVE_MMX2
+ #if HAVE_MMXEXT
 -static void gradfun_filter_line_mmx2(uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers)
 +static void gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers)
  {
      intptr_t x;
      if (width & 3) {
Simple merge
Simple merge
diff --cc libavutil/cpu.c
Simple merge
diff --cc libavutil/cpu.h
  
      /* lower 16 bits - CPU features */
  #define AV_CPU_FLAG_MMX          0x0001 ///< standard MMX
 -#if LIBAVUTIL_VERSION_MAJOR < 52
+ #define AV_CPU_FLAG_MMXEXT       0x0002 ///< SSE integer functions or AMD MMX ext
  #define AV_CPU_FLAG_MMX2         0x0002 ///< SSE integer functions or AMD MMX ext
 -#endif
  #define AV_CPU_FLAG_3DNOW        0x0004 ///< AMD 3DNOW
  #define AV_CPU_FLAG_SSE          0x0008 ///< SSE functions
  #define AV_CPU_FLAG_SSE2         0x0010 ///< PIV SSE2 functions
  
  unsigned avutil_version(void)
  {
 +    av_assert0(PIX_FMT_VDA_VLD == 81); //check if the pix fmt enum has not had anything inserted or removed by mistake
 +    av_assert0(AV_SAMPLE_FMT_DBLP == 9);
 +    av_assert0(AVMEDIA_TYPE_ATTACHMENT == 4);
 +    av_assert0(AV_PICTURE_TYPE_BI == 7);
 +    av_assert0(LIBAVUTIL_VERSION_MICRO >= 100);
++    av_assert0(HAVE_MMX2 == HAVE_MMXEXT);
 +
      return LIBAVUTIL_VERSION_INT;
  }
  
@@@ -39,8 -37,8 +39,8 @@@
   */
  
  #define LIBAVUTIL_VERSION_MAJOR 51
 -#define LIBAVUTIL_VERSION_MINOR 37
 -#define LIBAVUTIL_VERSION_MICRO  1
 +#define LIBAVUTIL_VERSION_MINOR 66
- #define LIBAVUTIL_VERSION_MICRO 100
++#define LIBAVUTIL_VERSION_MICRO 101
  
  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                 LIBAVUTIL_VERSION_MINOR, \
Simple merge
Simple merge
Simple merge
@@@ -1020,12 -968,13 +1020,12 @@@ av_cold int sws_init_context(SwsContex
      c->dstBpc = 1 + av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1;
      if (c->dstBpc < 8)
          c->dstBpc = 8;
 +    if (isAnyRGB(srcFormat) || srcFormat == PIX_FMT_PAL8)
 +        c->srcBpc = 16;
      if (c->dstBpc == 16)
          dst_stride <<= 1;
-     if (HAVE_MMX2 && HAVE_INLINE_ASM && cpu_flags & AV_CPU_FLAG_MMX2 &&
 -    FF_ALLOC_OR_GOTO(c, c->formatConvBuffer,
 -                     (FFALIGN(srcW, 16) * 2 * FFALIGN(c->srcBpc, 8) >> 3) + 16,
 -                     fail);
+     if (HAVE_MMXEXT && HAVE_INLINE_ASM && cpu_flags & AV_CPU_FLAG_MMXEXT &&
 -        c->srcBpc == 8 && c->dstBpc <= 10) {
 +        c->srcBpc == 8 && c->dstBpc <= 14) {
          c->canMMX2BeUsed = (dstW >= srcW && (dstW & 31) == 0 &&
                              (srcW & 15) == 0) ? 1 : 0;
          if (!c->canMMX2BeUsed && dstW >= srcW && (srcW & 15) == 0
  #else
                 "",
  #endif
 -               sws_format_name(dstFormat));
 +               av_get_pix_fmt_name(dstFormat));
  
-         if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2)
+         if (HAVE_MMXEXT && cpu_flags & AV_CPU_FLAG_MMXEXT)
              av_log(c, AV_LOG_INFO, "using MMX2\n");
          else if (HAVE_AMD3DNOW && cpu_flags & AV_CPU_FLAG_3DNOW)
              av_log(c, AV_LOG_INFO, "using 3DNOW\n");
@@@ -28,7 -28,7 +28,7 @@@
  
  #define LIBSWSCALE_VERSION_MAJOR 2
  #define LIBSWSCALE_VERSION_MINOR 1
- #define LIBSWSCALE_VERSION_MICRO 100
 -#define LIBSWSCALE_VERSION_MICRO 1
++#define LIBSWSCALE_VERSION_MICRO 101
  
  #define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
                                                 LIBSWSCALE_VERSION_MINOR, \
Simple merge
Simple merge
@@@ -375,13 -308,9 +375,13 @@@ av_cold void ff_sws_init_swScale_mmx(Sw
  #if HAVE_INLINE_ASM
      if (cpu_flags & AV_CPU_FLAG_MMX)
          sws_init_swScale_MMX(c);
- #if HAVE_MMX2
-     if (cpu_flags & AV_CPU_FLAG_MMX2)
+ #if HAVE_MMXEXT
+     if (cpu_flags & AV_CPU_FLAG_MMXEXT)
          sws_init_swScale_MMX2(c);
 +    if (cpu_flags & AV_CPU_FLAG_SSE3){
 +        if(c->use_mmx_vfilter && !(c->flags & SWS_ACCURATE_RND))
 +            c->yuv2planeX = yuv2yuvX_sse3;
 +    }
  #endif
  #endif /* HAVE_INLINE_ASM */
  
  
  #undef REAL_MOVNTQ
  #undef MOVNTQ
 +#undef MOVNTQ2
  #undef PREFETCH
  
- #if COMPILE_TEMPLATE_MMX2
+ #if COMPILE_TEMPLATE_MMXEXT
  #define PREFETCH "prefetchnta"
  #else
  #define PREFETCH  " # nop"
  #endif
  
- #if COMPILE_TEMPLATE_MMX2
+ #if COMPILE_TEMPLATE_MMXEXT
  #define REAL_MOVNTQ(a,b) "movntq " #a ", " #b " \n\t"
 +#define MOVNTQ2 "movntq "
  #else
  #define REAL_MOVNTQ(a,b) "movq " #a ", " #b " \n\t"
 +#define MOVNTQ2 "movq "
  #endif
  #define MOVNTQ(a,b)  REAL_MOVNTQ(a,b)
  
- #if !COMPILE_TEMPLATE_MMX2
++#if !COMPILE_TEMPLATE_MMXEXT
 +static av_always_inline void
 +dither_8to16(const uint8_t *srcDither, int rot)
 +{
 +    if (rot) {
 +        __asm__ volatile("pxor      %%mm0, %%mm0\n\t"
 +                         "movq       (%0), %%mm3\n\t"
 +                         "movq      %%mm3, %%mm4\n\t"
 +                         "psrlq       $24, %%mm3\n\t"
 +                         "psllq       $40, %%mm4\n\t"
 +                         "por       %%mm4, %%mm3\n\t"
 +                         "movq      %%mm3, %%mm4\n\t"
 +                         "punpcklbw %%mm0, %%mm3\n\t"
 +                         "punpckhbw %%mm0, %%mm4\n\t"
 +                         :: "r"(srcDither)
 +                         );
 +    } else {
 +        __asm__ volatile("pxor      %%mm0, %%mm0\n\t"
 +                         "movq       (%0), %%mm3\n\t"
 +                         "movq      %%mm3, %%mm4\n\t"
 +                         "punpcklbw %%mm0, %%mm3\n\t"
 +                         "punpckhbw %%mm0, %%mm4\n\t"
 +                         :: "r"(srcDither)
 +                         );
 +    }
 +}
 +#endif
 +
 +static void RENAME(yuv2yuvX)(const int16_t *filter, int filterSize,
 +                           const int16_t **src, uint8_t *dest, int dstW,
 +                           const uint8_t *dither, int offset)
 +{
 +    dither_8to16(dither, offset);
 +    __asm__ volatile(\
 +        "psraw        $4, %%mm3\n\t"
 +        "psraw        $4, %%mm4\n\t"
 +        "movq    %%mm3, %%mm6\n\t"
 +        "movq    %%mm4, %%mm7\n\t"
 +        "movl %3, %%ecx\n\t"
 +        "mov                                 %0, %%"REG_d"  \n\t"\
 +        "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
 +        ".p2align                             4             \n\t" /* FIXME Unroll? */\
 +        "1:                                                 \n\t"\
 +        "movq                      8(%%"REG_d"), %%mm0      \n\t" /* filterCoeff */\
 +        "movq                (%%"REG_S", %%"REG_c", 2), %%mm2      \n\t" /* srcData */\
 +        "movq               8(%%"REG_S", %%"REG_c", 2), %%mm5      \n\t" /* srcData */\
 +        "add                                $16, %%"REG_d"  \n\t"\
 +        "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
 +        "test                         %%"REG_S", %%"REG_S"  \n\t"\
 +        "pmulhw                           %%mm0, %%mm2      \n\t"\
 +        "pmulhw                           %%mm0, %%mm5      \n\t"\
 +        "paddw                            %%mm2, %%mm3      \n\t"\
 +        "paddw                            %%mm5, %%mm4      \n\t"\
 +        " jnz                                1b             \n\t"\
 +        "psraw                               $3, %%mm3      \n\t"\
 +        "psraw                               $3, %%mm4      \n\t"\
 +        "packuswb                         %%mm4, %%mm3      \n\t"
 +        MOVNTQ2 "                         %%mm3, (%1, %%"REG_c")\n\t"
 +        "add                          $8, %%"REG_c"         \n\t"\
 +        "cmp                          %2, %%"REG_c"         \n\t"\
 +        "movq    %%mm6, %%mm3\n\t"
 +        "movq    %%mm7, %%mm4\n\t"
 +        "mov                                 %0, %%"REG_d"  \n\t"\
 +        "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
 +        "jb                                  1b             \n\t"\
 +        :: "g" (filter),
 +           "r" (dest-offset), "g" ((x86_reg)(dstW+offset)), "m" (offset)
 +        : "%"REG_d, "%"REG_S, "%"REG_c
 +    );
 +}
 +
  #define YSCALEYUV2PACKEDX_UV \
      __asm__ volatile(\
          "xor                   %%"REG_a", %%"REG_a"     \n\t"\
@@@ -1689,9 -1614,9 +1689,9 @@@ static av_cold void RENAME(sws_init_swS
          }
      }
  
 -    if (c->srcBpc == 8 && c->dstBpc <= 10) {
 +    if (c->srcBpc == 8 && c->dstBpc <= 14) {
      // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one).
- #if COMPILE_TEMPLATE_MMX2
+ #if COMPILE_TEMPLATE_MMXEXT
      if (c->flags & SWS_FAST_BILINEAR && c->canMMX2BeUsed)
      {
          c->hyscale_fast = RENAME(hyscale_fast);
@@@ -74,8 -74,12 +74,8 @@@ av_cold SwsFunc ff_yuv2rgb_init_mmx(Sws
  #if HAVE_INLINE_ASM
      int cpu_flags = av_get_cpu_flags();
  
- #if HAVE_MMX2
-     if (cpu_flags & AV_CPU_FLAG_MMX2) {
 -    if (c->srcFormat != PIX_FMT_YUV420P &&
 -        c->srcFormat != PIX_FMT_YUVA420P)
 -        return NULL;
 -
+ #if HAVE_MMXEXT
+     if (cpu_flags & AV_CPU_FLAG_MMXEXT) {
          switch (c->dstFormat) {
          case PIX_FMT_RGB24:  return yuv420_rgb24_MMX2;
          case PIX_FMT_BGR24:  return yuv420_bgr24_MMX2;
Simple merge
Simple merge