]> git.sesse.net Git - ffmpeg/blobdiff - libswscale/swscale_internal.h
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libswscale / swscale_internal.h
index 1c9e62a79f4590e629f4b41f1cdf233fe5beba91..fb63ccdb29b4d4e9459f8cf9c1c45dedf1285078 100644 (file)
@@ -61,56 +61,58 @@ typedef int (*SwsFunc)(struct SwsContext *context, const uint8_t* src[],
                        int srcStride[], int srcSliceY, int srcSliceH,
                        uint8_t* dst[], int dstStride[]);
 
+
 /**
- * Write one line of horizontally scaled Y/U/V/A to planar output
+ * Write one line of horizontally scaled data to planar output
  * without any additional vertical scaling (or point-scaling).
  *
- * @param c       SWS scaling context
- * @param lumSrc  scaled luma (Y) source data, 15bit for 8-10bit output,
- *                19-bit for 16bit output (in int32_t)
- * @param chrUSrc scaled chroma (U) source data, 15bit for 8-10bit output,
- *                19-bit for 16bit output (in int32_t)
- * @param chrVSrc scaled chroma (V) source data, 15bit for 8-10bit output,
+ * @param src     scaled source data, 15bit for 8-10bit output,
  *                19-bit for 16bit output (in int32_t)
- * @param alpSrc  scaled alpha (A) source data, 15bit for 8-10bit output,
- *                19-bit for 16bit output (in int32_t)
- * @param dest    pointer to the 4 output planes (Y/U/V/A). For >8bit
+ * @param dest    pointer to the output plane. For >8bit
  *                output, this is in uint16_t
- * @param dstW    width of dest[0], dest[3], lumSrc and alpSrc in pixels
- * @param chrDstW width of dest[1], dest[2], chrUSrc and chrVSrc
+ * @param dstW    width of destination in pixels
+ * @param dither  ordered dither array of type int16_t and size 8
+ * @param offset  Dither offset
  */
-typedef void (*yuv2planar1_fn) (struct SwsContext *c,
-                                const int16_t *lumSrc, const int16_t *chrUSrc,
-                                const int16_t *chrVSrc, const int16_t *alpSrc,
-                                uint8_t *dest[4], int dstW, int chrDstW);
+typedef void (*yuv2planar1_fn) (const int16_t *src, uint8_t *dest, int dstW,
+                                const uint8_t *dither, int offset);
+
 /**
- * Write one line of horizontally scaled Y/U/V/A to planar output
+ * Write one line of horizontally scaled data to planar output
  * with multi-point vertical scaling between input pixels.
  *
- * @param c             SWS scaling context
- * @param lumFilter     vertical luma/alpha scaling coefficients, 12bit [0,4096]
- * @param lumSrc        scaled luma (Y) source data, 15bit for 8-10bit output,
+ * @param filter        vertical luma/alpha scaling coefficients, 12bit [0,4096]
+ * @param src           scaled luma (Y) or alpha (A) source data, 15bit for 8-10bit output,
  *                      19-bit for 16bit output (in int32_t)
- * @param lumFilterSize number of vertical luma/alpha input lines to scale
+ * @param filterSize    number of vertical input lines to scale
+ * @param dest          pointer to output plane. For >8bit
+ *                      output, this is in uint16_t
+ * @param dstW          width of destination pixels
+ * @param offset        Dither offset
+ */
+typedef void (*yuv2planarX_fn) (const int16_t *filter, int filterSize,
+                                const int16_t **src, uint8_t *dest, int dstW,
+                                const uint8_t *dither, int offset);
+
+/**
+ * Write one line of horizontally scaled chroma to interleaved output
+ * with multi-point vertical scaling between input pixels.
+ *
+ * @param c             SWS scaling context
  * @param chrFilter     vertical chroma scaling coefficients, 12bit [0,4096]
  * @param chrUSrc       scaled chroma (U) source data, 15bit for 8-10bit output,
  *                      19-bit for 16bit output (in int32_t)
  * @param chrVSrc       scaled chroma (V) source data, 15bit for 8-10bit output,
  *                      19-bit for 16bit output (in int32_t)
  * @param chrFilterSize number of vertical chroma input lines to scale
- * @param alpSrc        scaled alpha (A) source data, 15bit for 8-10bit output,
- *                      19-bit for 16bit output (in int32_t)
- * @param dest          pointer to the 4 output planes (Y/U/V/A). For >8bit
+ * @param dest          pointer to the output plane. For >8bit
  *                      output, this is in uint16_t
- * @param dstW          width of dest[0], dest[3], lumSrc and alpSrc in pixels
- * @param chrDstW       width of dest[1], dest[2], chrUSrc and chrVSrc
+ * @param dstW          width of chroma planes
  */
-typedef void (*yuv2planarX_fn) (struct SwsContext *c, const int16_t *lumFilter,
-                                const int16_t **lumSrc, int lumFilterSize,
-                                const int16_t *chrFilter, const int16_t **chrUSrc,
-                                const int16_t **chrVSrc,  int chrFilterSize,
-                                const int16_t **alpSrc, uint8_t *dest[4],
-                                int dstW, int chrDstW);
+typedef void (*yuv2interleavedX_fn) (struct SwsContext *c, const int16_t *chrFilter, int chrFilterSize,
+                                     const int16_t **chrUSrc, const int16_t **chrVSrc,
+                                     uint8_t *dest, int dstW);
+
 /**
  * Write one line of horizontally scaled Y/U/V/A to packed-pixel YUV/RGB
  * output without any additional vertical scaling (or point-scaling). Note
@@ -410,10 +412,12 @@ typedef struct SwsContext {
 #if HAVE_VIS
     DECLARE_ALIGNED(8, uint64_t, sparc_coeffs)[10];
 #endif
+    int use_mmx_vfilter;
 
     /* function pointers for swScale() */
-    yuv2planar1_fn yuv2yuv1;
-    yuv2planarX_fn yuv2yuvX;
+    yuv2planar1_fn yuv2plane1;
+    yuv2planarX_fn yuv2planeX;
+    yuv2interleavedX_fn yuv2nv12cX;
     yuv2packed1_fn yuv2packed1;
     yuv2packed2_fn yuv2packed2;
     yuv2packedX_fn yuv2packedX;
@@ -547,6 +551,8 @@ const char *sws_format_name(enum PixelFormat format);
 #define isNBPS(x)       (           \
            (x)==PIX_FMT_YUV420P9LE  \
         || (x)==PIX_FMT_YUV420P9BE  \
+        || (x)==PIX_FMT_YUV422P9LE  \
+        || (x)==PIX_FMT_YUV422P9BE  \
         || (x)==PIX_FMT_YUV444P9BE  \
         || (x)==PIX_FMT_YUV444P9LE  \
         || (x)==PIX_FMT_YUV422P10BE \
@@ -574,6 +580,7 @@ const char *sws_format_name(enum PixelFormat format);
 #define isPlanarYUV(x)  (           \
         isPlanar8YUV(x)             \
         || (x)==PIX_FMT_YUV420P9LE  \
+        || (x)==PIX_FMT_YUV422P9LE  \
         || (x)==PIX_FMT_YUV444P9LE  \
         || (x)==PIX_FMT_YUV420P10LE \
         || (x)==PIX_FMT_YUV422P10LE \
@@ -583,6 +590,7 @@ const char *sws_format_name(enum PixelFormat format);
         || (x)==PIX_FMT_YUV422P16LE \
         || (x)==PIX_FMT_YUV444P16LE \
         || (x)==PIX_FMT_YUV420P9BE  \
+        || (x)==PIX_FMT_YUV422P9BE  \
         || (x)==PIX_FMT_YUV444P9BE  \
         || (x)==PIX_FMT_YUV420P10BE \
         || (x)==PIX_FMT_YUV422P10BE \
@@ -592,6 +600,12 @@ const char *sws_format_name(enum PixelFormat format);
         || (x)==PIX_FMT_YUV422P16BE \
         || (x)==PIX_FMT_YUV444P16BE \
     )
+
+#define isPlanar(x)  (              \
+        isPlanarYUV(x)              \
+        ||  (x)==PIX_FMT_GBR24P     \
+    )
+
 #define isYUV(x)        (           \
            (x)==PIX_FMT_UYVY422     \
         || (x)==PIX_FMT_YUYV422     \
@@ -668,6 +682,7 @@ const char *sws_format_name(enum PixelFormat format);
 #define isAnyRGB(x)     (           \
             isRGBinInt(x)           \
         ||  isBGRinInt(x)           \
+        ||  (x)==PIX_FMT_GBR24P     \
     )
 #define isALPHA(x)      (           \
            (x)==PIX_FMT_BGRA64BE    \
@@ -687,7 +702,8 @@ const char *sws_format_name(enum PixelFormat format);
         || (x)==PIX_FMT_YUYV422     \
         || (x)==PIX_FMT_UYVY422     \
         || (x)==PIX_FMT_Y400A       \
-        || isAnyRGB(x)              \
+        ||  isRGBinInt(x)           \
+        ||  isBGRinInt(x)           \
     )
 #define usePal(x) ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || (x) == PIX_FMT_GRAY8A)