Merge commit 'a65bdceb060628881578afb29df4eb222421381f'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 31 Oct 2012 13:08:49 +0000 (14:08 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 31 Oct 2012 13:08:49 +0000 (14:08 +0100)
* commit 'a65bdceb060628881578afb29df4eb222421381f':
  x86: mmx2 ---> mmxext in variable names

Conflicts:
libswscale/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libswscale/swscale_internal.h
libswscale/utils.c
libswscale/x86/swscale_template.c

Simple merge
@@@ -1058,23 -995,24 +1058,25 @@@ av_cold int sws_init_context(SwsContex
      c->dstBpc = 1 + desc_dst->comp[0].depth_minus1;
      if (c->dstBpc < 8)
          c->dstBpc = 8;
 +    if (isAnyRGB(srcFormat) || srcFormat == AV_PIX_FMT_PAL8)
 +        c->srcBpc = 16;
      if (c->dstBpc == 16)
          dst_stride <<= 1;
 -    FF_ALLOC_OR_GOTO(c, c->formatConvBuffer,
 -                     (FFALIGN(srcW, 16) * 2 * FFALIGN(c->srcBpc, 8) >> 3) + 16,
 -                     fail);
 -    if (INLINE_MMXEXT(cpu_flags) && c->srcBpc == 8 && c->dstBpc <= 10) {
++
 +    if (INLINE_MMXEXT(cpu_flags) && 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
+         c->canMMXEXTBeUsed = (dstW >= srcW && (dstW & 31) == 0 &&
+                               (srcW & 15) == 0) ? 1 : 0;
+         if (!c->canMMXEXTBeUsed && dstW >= srcW && (srcW & 15) == 0
++
              && (flags & SWS_FAST_BILINEAR)) {
              if (flags & SWS_PRINT_INFO)
                  av_log(c, AV_LOG_INFO,
                         "output width is not a multiple of 32 -> no MMXEXT scaler\n");
          }
 -        if (usesHFilter)
 +        if (usesHFilter || isNBPS(c->srcFormat) || is16BPS(c->srcFormat) || isAnyRGB(c->srcFormat))
-             c->canMMX2BeUsed=0;
+             c->canMMXEXTBeUsed = 0;
      } else
-         c->canMMX2BeUsed = 0;
+         c->canMMXEXTBeUsed = 0;
  
      c->chrXInc = (((int64_t)c->chrSrcW << 16) + (c->chrDstW >> 1)) / c->chrDstW;
      c->chrYInc = (((int64_t)c->chrSrcH << 16) + (c->chrDstH >> 1)) / c->chrDstH;
      {
  #if HAVE_MMXEXT_INLINE
  // can't downscale !!!
-         if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) {
-             c->lumMmx2FilterCodeSize = initMMX2HScaler(dstW, c->lumXInc, NULL,
-                                                        NULL, NULL, 8);
-             c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc,
-                                                        NULL, NULL, NULL, 4);
+         if (c->canMMXEXTBeUsed && (flags & SWS_FAST_BILINEAR)) {
+             c->lumMmxextFilterCodeSize = initMMX2HScaler(dstW, c->lumXInc, NULL,
+                                                          NULL, NULL, 8);
+             c->chrMmxextFilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc,
+                                                          NULL, NULL, NULL, 4);
  
  #if USE_MMAP
-             c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-             c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+             c->lumMmxextFilterCode = mmap(NULL, c->lumMmxextFilterCodeSize,
+                                           PROT_READ | PROT_WRITE,
+                                           MAP_PRIVATE | MAP_ANONYMOUS,
+                                           -1, 0);
+             c->chrMmxextFilterCode = mmap(NULL, c->chrMmxextFilterCodeSize,
+                                           PROT_READ | PROT_WRITE,
+                                           MAP_PRIVATE | MAP_ANONYMOUS,
+                                           -1, 0);
  #elif HAVE_VIRTUALALLOC
-             c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
-             c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+             c->lumMmxextFilterCode = VirtualAlloc(NULL,
+                                                   c->lumMmxextFilterCodeSize,
+                                                   MEM_COMMIT,
+                                                   PAGE_EXECUTE_READWRITE);
+             c->chrMmxextFilterCode = VirtualAlloc(NULL,
+                                                   c->chrMmxextFilterCodeSize,
+                                                   MEM_COMMIT,
+                                                   PAGE_EXECUTE_READWRITE);
  #else
-             c->lumMmx2FilterCode = av_malloc(c->lumMmx2FilterCodeSize);
-             c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize);
+             c->lumMmxextFilterCode = av_malloc(c->lumMmxextFilterCodeSize);
+             c->chrMmxextFilterCode = av_malloc(c->chrMmxextFilterCodeSize);
  #endif
  
-             if (c->lumMmx2FilterCode == MAP_FAILED || c->chrMmx2FilterCode == MAP_FAILED)
 +#ifdef MAP_ANONYMOUS
-             if (!c->lumMmx2FilterCode || !c->chrMmx2FilterCode)
++            if (c->lumMmxextFilterCode == MAP_FAILED || c->chrMmxextFilterCode == MAP_FAILED)
 +#else
+             if (!c->lumMmxextFilterCode || !c->chrMmxextFilterCode)
 +#endif
 +            {
 +                av_log(c, AV_LOG_ERROR, "Failed to allocate MMX2FilterCode\n");
                  return AVERROR(ENOMEM);
 +            }
 +
              FF_ALLOCZ_OR_GOTO(c, c->hLumFilter,    (dstW           / 8 + 8) * sizeof(int16_t), fail);
              FF_ALLOCZ_OR_GOTO(c, c->hChrFilter,    (c->chrDstW     / 4 + 8) * sizeof(int16_t), fail);
              FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW       / 2 / 8 + 8) * sizeof(int32_t), fail);
              FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW / 2 / 4 + 8) * sizeof(int32_t), fail);
  
-             initMMX2HScaler(      dstW, c->lumXInc, c->lumMmx2FilterCode,
 -            initMMX2HScaler(dstW, c->lumXInc, c->lumMmxextFilterCode,
 -                            c->hLumFilter, c->hLumFilterPos, 8);
++            initMMX2HScaler(      dstW, c->lumXInc, c->lumMmxextFilterCode,
 +                            c->hLumFilter, (uint32_t*)c->hLumFilterPos, 8);
-             initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode,
+             initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmxextFilterCode,
 -                            c->hChrFilter, c->hChrFilterPos, 4);
 +                            c->hChrFilter, (uint32_t*)c->hChrFilterPos, 4);
  
  #if USE_MMAP
-             mprotect(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
-             mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
+             mprotect(c->lumMmxextFilterCode, c->lumMmxextFilterCodeSize, PROT_EXEC | PROT_READ);
+             mprotect(c->chrMmxextFilterCode, c->chrMmxextFilterCodeSize, PROT_EXEC | PROT_READ);
  #endif
          } else
  #endif /* HAVE_MMXEXT_INLINE */
@@@ -1689,11 -1614,10 +1689,10 @@@ 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 MMXEXT one can't be used (it is faster than the x86 ASM one).
  #if COMPILE_TEMPLATE_MMXEXT
-     if (c->flags & SWS_FAST_BILINEAR && c->canMMX2BeUsed)
-     {
+     if (c->flags & SWS_FAST_BILINEAR && c->canMMXEXTBeUsed) {
          c->hyscale_fast = RENAME(hyscale_fast);
          c->hcscale_fast = RENAME(hcscale_fast);
      } else {