Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 14 Jan 2012 01:22:09 +0000 (02:22 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 14 Jan 2012 01:22:09 +0000 (02:22 +0100)
* qatar/master:
  FATE: add tests for targa
  ARM: fix Thumb-mode simple_idct_arm
  ARM: 4-byte align start of all asm functions
  rgb2rgb: rgb12to15()
  swscale-test: fix stack overread.
  swscale: fix invalid conversions and memory problems.
  cabac: split cabac.h into declarations and function definitions
  cabac: Mark ff_h264_mps_state array as static, it is only used within cabac.c.
  cabac: Remove ff_h264_lps_state array.

Conflicts:
libswscale/rgb2rgb.h
libswscale/swscale_unscaled.c
tests/fate/image.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/arm/asm.S
libavcodec/arm/simple_idct_arm.S
libavcodec/cabac.c
libavcodec/cabac.h
libavcodec/h264.c
libavcodec/h264_cabac.c
libswscale/rgb2rgb.c
libswscale/rgb2rgb.h
libswscale/swscale-test.c
libswscale/swscale_unscaled.c
tests/fate/image.mak

Simple merge
Simple merge
@@@ -141,19 -141,15 +141,19 @@@ void ff_init_cabac_states(CABACContext 
          }
  
          ff_h264_mlps_state[128+2*i+0]=
-         ff_h264_mps_state[2*i+0]= 2*mps_state[i]+0;
+         h264_mps_state[2 * i + 0] = 2 * mps_state[i] + 0;
          ff_h264_mlps_state[128+2*i+1]=
-         ff_h264_mps_state[2*i+1]= 2*mps_state[i]+1;
+         h264_mps_state[2 * i + 1] = 2 * mps_state[i] + 1;
  
          if( i ){
 +            ff_h264_lps_state[2*i+0]=
              ff_h264_mlps_state[128-2*i-1]= 2*lps_state[i]+0;
 +            ff_h264_lps_state[2*i+1]=
              ff_h264_mlps_state[128-2*i-2]= 2*lps_state[i]+1;
          }else{
 +            ff_h264_lps_state[2*i+0]=
              ff_h264_mlps_state[128-2*i-1]= 1;
 +            ff_h264_lps_state[2*i+1]=
              ff_h264_mlps_state[128-2*i-2]= 0;
          }
      }
Simple merge
   * @author Michael Niedermayer <michaelni@gmx.at>
   */
  
 +#define UNCHECKED_BITSTREAM_READER 1
 +
  #include "libavutil/imgutils.h"
 +#include "libavutil/opt.h"
  #include "internal.h"
+ #include "cabac.h"
+ #include "cabac_functions.h"
  #include "dsputil.h"
  #include "avcodec.h"
  #include "mpegvideo.h"
   */
  
  #define CABAC 1
 +#define UNCHECKED_BITSTREAM_READER 1
  
+ #include "config.h"
+ #include "cabac.h"
+ #include "cabac_functions.h"
  #include "internal.h"
  #include "dsputil.h"
  #include "avcodec.h"
Simple merge
@@@ -63,6 -63,8 +63,7 @@@ void    rgb15to24(const uint8_t *src, u
  void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int src_size);
  void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size);
  void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size);
 -void   bgr8torgb8(const uint8_t *src, uint8_t *dst, int src_size);
+ void    rgb12to15(const uint8_t *src, uint8_t *dst, int src_size);
  
  void shuffle_bytes_0321(const uint8_t *src, uint8_t *dst, int src_size);
  void shuffle_bytes_1230(const uint8_t *src, uint8_t *dst, int src_size);
Simple merge
@@@ -463,9 -425,24 +469,24 @@@ static rgbConvFn findRgbConvFn(SwsConte
          }
      }
  
+     return conv;
+ }
+ /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
+ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
+                            int srcSliceY, int srcSliceH, uint8_t *dst[],
+                            int dstStride[])
+ {
+     const enum PixelFormat srcFormat = c->srcFormat;
+     const enum PixelFormat dstFormat = c->dstFormat;
+     const int srcBpp = (c->srcFormatBpp + 7) >> 3;
+     const int dstBpp = (c->dstFormatBpp + 7) >> 3;
+     rgbConvFn conv = findRgbConvFn(c);
      if (!conv) {
          av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
 -               sws_format_name(srcFormat), sws_format_name(dstFormat));
 +               av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat));
      } else {
          const uint8_t *srcPtr = src[0];
                uint8_t *dstPtr = dst[0];
@@@ -748,37 -793,10 +771,21 @@@ void ff_get_unscaled_swscale(SwsContex
          c->swScale = bgr24ToYv12Wrapper;
  
      /* RGB/BGR -> RGB/BGR (no dither needed forms) */
-     if (   isAnyRGB(srcFormat)
-         && isAnyRGB(dstFormat)
-         && srcFormat != PIX_FMT_BGR8      && dstFormat != PIX_FMT_BGR8
-         && srcFormat != PIX_FMT_RGB8      && dstFormat != PIX_FMT_RGB8
-         && srcFormat != PIX_FMT_BGR4      && dstFormat != PIX_FMT_BGR4
-         && srcFormat != PIX_FMT_RGB4      && dstFormat != PIX_FMT_RGB4
-         && srcFormat != PIX_FMT_BGR4_BYTE && dstFormat != PIX_FMT_BGR4_BYTE
-         && srcFormat != PIX_FMT_RGB4_BYTE && dstFormat != PIX_FMT_RGB4_BYTE
-         && srcFormat != PIX_FMT_MONOBLACK && dstFormat != PIX_FMT_MONOBLACK
-         && srcFormat != PIX_FMT_MONOWHITE && dstFormat != PIX_FMT_MONOWHITE
-         && srcFormat != PIX_FMT_RGB48LE   && dstFormat != PIX_FMT_RGB48LE
-         && srcFormat != PIX_FMT_RGB48BE   && dstFormat != PIX_FMT_RGB48BE
-         && srcFormat != PIX_FMT_BGR48LE   && dstFormat != PIX_FMT_BGR48LE
-         && srcFormat != PIX_FMT_BGR48BE   && dstFormat != PIX_FMT_BGR48BE
-         && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)))
-         && (!(av_pix_fmt_descriptors[srcFormat].flags & PIX_FMT_BE) == !HAVE_BIGENDIAN || (c->srcFormatBpp+7)/8!=2)
-         && (!(av_pix_fmt_descriptors[dstFormat].flags & PIX_FMT_BE) == !HAVE_BIGENDIAN || (c->dstFormatBpp+7)/8!=2)
-     )
+     if (isAnyRGB(srcFormat) && isAnyRGB(dstFormat) && findRgbConvFn(c)
+         && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
          c->swScale= rgbToRgbWrapper;
  
 +#define isByteRGB(f) (\
 +        f == PIX_FMT_RGB32   ||\
 +        f == PIX_FMT_RGB32_1 ||\
 +        f == PIX_FMT_RGB24   ||\
 +        f == PIX_FMT_BGR32   ||\
 +        f == PIX_FMT_BGR32_1 ||\
 +        f == PIX_FMT_BGR24)
 +
 +    if (isAnyRGB(srcFormat) && isPlanar(srcFormat) && isByteRGB(dstFormat))
 +        c->swScale= planarRgbToRgbWrapper;
 +
      /* bswap 16 bits per pixel/component packed formats */
      if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR444) ||
          IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR48)  ||
@@@ -1,35 -1,60 +1,62 @@@
 -FATE_TESTS += fate-dpx
 +FATE_IMAGE += fate-dpx
  fate-dpx: CMD = framecrc -i $(SAMPLES)/dpx/lighthouse_rgb48.dpx
  
 -FATE_TESTS += fate-fax-g3
 +FATE_IMAGE += fate-fax-g3
  fate-fax-g3: CMD = framecrc -i $(SAMPLES)/CCITT_fax/G31D.TIF
  
 -FATE_TESTS += fate-fax-g3s
 +FATE_IMAGE += fate-fax-g3s
  fate-fax-g3s: CMD = framecrc -i $(SAMPLES)/CCITT_fax/G31DS.TIF
  
 -FATE_TESTS += fate-pictor
 +FATE_IMAGE += fate-pictor
  fate-pictor: CMD = framecrc -i $(SAMPLES)/pictor/MFISH.PIC -pix_fmt rgb24
  
 -FATE_TESTS += fate-ptx
 +FATE_IMAGE += fate-ptx
  fate-ptx: CMD = framecrc -i $(SAMPLES)/ptx/_113kw_pic.ptx -pix_fmt rgb24
  
 -FATE_TESTS += fate-sunraster-1bit-raw
 +FATE_IMAGE += fate-sunraster-1bit-raw
  fate-sunraster-1bit-raw: CMD = framecrc -i $(SAMPLES)/sunraster/lena-1bit-raw.sun
  
 -FATE_TESTS += fate-sunraster-1bit-rle
 +FATE_IMAGE += fate-sunraster-1bit-rle
  fate-sunraster-1bit-rle: CMD = framecrc -i $(SAMPLES)/sunraster/lena-1bit-rle.sun
  
 -FATE_TESTS += fate-sunraster-8bit-raw
 +FATE_IMAGE += fate-sunraster-8bit-raw
  fate-sunraster-8bit-raw: CMD = framecrc -i $(SAMPLES)/sunraster/lena-8bit-raw.sun -pix_fmt rgb24
  
 -FATE_TESTS += fate-sunraster-8bit-rle
 +FATE_IMAGE += fate-sunraster-8bit-rle
  fate-sunraster-8bit-rle: CMD = framecrc -i $(SAMPLES)/sunraster/lena-8bit-rle.sun -pix_fmt rgb24
  
 -FATE_TESTS += fate-sunraster-24bit-raw
 +FATE_IMAGE += fate-sunraster-24bit-raw
  fate-sunraster-24bit-raw: CMD = framecrc -i $(SAMPLES)/sunraster/lena-24bit-raw.sun
  
 -FATE_TESTS += fate-sunraster-24bit-rle
 +FATE_IMAGE += fate-sunraster-24bit-rle
  fate-sunraster-24bit-rle: CMD = framecrc -i $(SAMPLES)/sunraster/lena-24bit-rle.sun
 +FATE_TESTS += $(FATE_IMAGE)
 +fate-image: $(FATE_IMAGE)
+ FATE_TARGA = CBW8       \
+              CTC16      \
+              CTC24      \
+              CTC32      \
+              UBW8       \
+              UTC16      \
+              UTC24      \
+              UTC32
+ FATE_TARGA := $(FATE_TARGA:%=fate-targa-conformance-%)  \
+               fate-targa-top-to-bottom
+ FATE_TESTS += $(FATE_TARGA)
+ fate-targa: $(FATE_TARGA)
+ fate-targa-conformance-CBW8:  CMD = framecrc -i $(SAMPLES)/targa-conformance/CBW8.TGA
+ # fate-targa-conformance-CCM8:  CMD = framecrc -i $(SAMPLES)/targa-conformance/CCM8.TGA
+ fate-targa-conformance-CTC16: CMD = framecrc -i $(SAMPLES)/targa-conformance/CTC16.TGA
+ fate-targa-conformance-CTC24: CMD = framecrc -i $(SAMPLES)/targa-conformance/CTC24.TGA
+ fate-targa-conformance-CTC32: CMD = framecrc -i $(SAMPLES)/targa-conformance/CTC32.TGA
+ fate-targa-conformance-UBW8:  CMD = framecrc -i $(SAMPLES)/targa-conformance/UBW8.TGA
+ # fate-targa-conformance-UCM8:  CMD = framecrc -i $(SAMPLES)/targa-conformance/UCM8.TGA
+ fate-targa-conformance-UTC16: CMD = framecrc -i $(SAMPLES)/targa-conformance/UTC16.TGA
+ fate-targa-conformance-UTC24: CMD = framecrc -i $(SAMPLES)/targa-conformance/UTC24.TGA
+ fate-targa-conformance-UTC32: CMD = framecrc -i $(SAMPLES)/targa-conformance/UTC32.TGA
+ fate-targa-top-to-bottom: CMD = framecrc -i $(SAMPLES)/targa/lena-top-to-bottom.tga