pixfmt: Add yuv422p12 pixel format
authorLuca Barbato <lu_zero@gentoo.org>
Sat, 24 Sep 2016 18:22:56 +0000 (20:22 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Tue, 27 Sep 2016 16:48:30 +0000 (18:48 +0200)
libavutil/pixdesc.c
libavutil/pixfmt.h
libswscale/input.c
libswscale/swscale_unscaled.c
libswscale/utils.c
tests/ref/fate/filter-pixdesc-yuv422p12be [new file with mode: 0644]
tests/ref/fate/filter-pixdesc-yuv422p12le [new file with mode: 0644]
tests/ref/fate/filter-pixfmts-copy
tests/ref/fate/filter-pixfmts-null
tests/ref/fate/filter-pixfmts-scale
tests/ref/fate/filter-pixfmts-vflip

index 8f116fc..e0c7851 100644 (file)
@@ -1270,6 +1270,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         },
         .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
     },
+    [AV_PIX_FMT_YUV422P12LE] = {
+        .name = "yuv422p12le",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 2, 0, 0, 12, 1, 11, 1 },        /* Y */
+            { 1, 2, 0, 0, 12, 1, 11, 1 },        /* U */
+            { 2, 2, 0, 0, 12, 1, 11, 1 },        /* V */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR,
+    },
+    [AV_PIX_FMT_YUV422P12BE] = {
+        .name = "yuv422p12be",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 2, 0, 0, 12, 1, 11, 1 },        /* Y */
+            { 1, 2, 0, 0, 12, 1, 11, 1 },        /* U */
+            { 2, 2, 0, 0, 12, 1, 11, 1 },        /* V */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
+    },
     [AV_PIX_FMT_YUV422P16LE] = {
         .name = "yuv422p16le",
         .nb_components = 3,
@@ -1867,6 +1891,7 @@ enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
     PIX_FMT_SWAP_ENDIANNESS(YUV422P10);
     PIX_FMT_SWAP_ENDIANNESS(YUV444P10);
     PIX_FMT_SWAP_ENDIANNESS(YUV420P12);
+    PIX_FMT_SWAP_ENDIANNESS(YUV422P12);
     PIX_FMT_SWAP_ENDIANNESS(YUV420P16);
     PIX_FMT_SWAP_ENDIANNESS(YUV422P16);
     PIX_FMT_SWAP_ENDIANNESS(YUV444P16);
index 658d5bf..3e356af 100644 (file)
@@ -233,6 +233,9 @@ enum AVPixelFormat {
     AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0, 18bpp, (1 Cr & Cb sample per 2x2 Y), big-endian
     AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0, 18bpp, (1 Cr & Cb sample per 2x2 Y), little-endian
 
+    AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2, 24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+    AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2, 24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+
     AV_PIX_FMT_NB,        ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
 };
 
@@ -267,6 +270,7 @@ enum AVPixelFormat {
 #define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE)
 #define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE)
 #define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE)
+#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE)
 #define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
 #define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
 #define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
index 9c0a32c..76a4700 100644 (file)
@@ -816,6 +816,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
     case AV_PIX_FMT_YUV422P10LE:
     case AV_PIX_FMT_YUV444P10LE:
     case AV_PIX_FMT_YUV420P12LE:
+    case AV_PIX_FMT_YUV422P12LE:
     case AV_PIX_FMT_YUV420P16LE:
     case AV_PIX_FMT_YUV422P16LE:
     case AV_PIX_FMT_YUV444P16LE:
@@ -838,6 +839,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
     case AV_PIX_FMT_YUV422P10BE:
     case AV_PIX_FMT_YUV444P10BE:
     case AV_PIX_FMT_YUV420P12BE:
+    case AV_PIX_FMT_YUV422P12BE:
     case AV_PIX_FMT_YUV420P16BE:
     case AV_PIX_FMT_YUV422P16BE:
     case AV_PIX_FMT_YUV444P16BE:
@@ -1036,6 +1038,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
     case AV_PIX_FMT_YUV422P10LE:
     case AV_PIX_FMT_YUV444P10LE:
     case AV_PIX_FMT_YUV420P12LE:
+    case AV_PIX_FMT_YUV422P12LE:
     case AV_PIX_FMT_YUV420P16LE:
     case AV_PIX_FMT_YUV422P16LE:
     case AV_PIX_FMT_YUV444P16LE:
@@ -1062,6 +1065,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
     case AV_PIX_FMT_YUV422P10BE:
     case AV_PIX_FMT_YUV444P10BE:
     case AV_PIX_FMT_YUV420P12BE:
+    case AV_PIX_FMT_YUV422P12BE:
     case AV_PIX_FMT_YUV420P16BE:
     case AV_PIX_FMT_YUV422P16BE:
     case AV_PIX_FMT_YUV444P16BE:
index 87331ae..31706ca 100644 (file)
@@ -1158,9 +1158,11 @@ void ff_get_unscaled_swscale(SwsContext *c)
          dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21 &&
          dstFormat != AV_PIX_FMT_P010LE && dstFormat != AV_PIX_FMT_P010BE &&
          dstFormat != AV_PIX_FMT_YUV420P12LE && dstFormat != AV_PIX_FMT_YUV420P12BE &&
+         dstFormat != AV_PIX_FMT_YUV422P12LE && dstFormat != AV_PIX_FMT_YUV422P12BE &&
          srcFormat != AV_PIX_FMT_NV12 && srcFormat != AV_PIX_FMT_NV21 &&
          srcFormat != AV_PIX_FMT_P010LE && srcFormat != AV_PIX_FMT_P010BE &&
-         srcFormat != AV_PIX_FMT_YUV420P12LE && srcFormat != AV_PIX_FMT_YUV420P12BE))
+         srcFormat != AV_PIX_FMT_YUV420P12LE && srcFormat != AV_PIX_FMT_YUV420P12BE &&
+         srcFormat != AV_PIX_FMT_YUV422P12LE && srcFormat != AV_PIX_FMT_YUV422P12BE))
     {
         if (isPacked(c->srcFormat))
             c->swscale = packedCopyWrapper;
index 06b9c1c..dc44292 100644 (file)
@@ -171,6 +171,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
     [AV_PIX_FMT_YUV422P9LE]  = { 1, 1 },
     [AV_PIX_FMT_YUV422P10BE] = { 1, 1 },
     [AV_PIX_FMT_YUV422P10LE] = { 1, 1 },
+    [AV_PIX_FMT_YUV422P12BE] = { 1, 1 },
+    [AV_PIX_FMT_YUV422P12LE] = { 1, 1 },
     [AV_PIX_FMT_YUV444P9BE]  = { 1, 1 },
     [AV_PIX_FMT_YUV444P9LE]  = { 1, 1 },
     [AV_PIX_FMT_YUV444P10BE] = { 1, 1 },
diff --git a/tests/ref/fate/filter-pixdesc-yuv422p12be b/tests/ref/fate/filter-pixdesc-yuv422p12be
new file mode 100644 (file)
index 0000000..8cfd917
--- /dev/null
@@ -0,0 +1 @@
+pixdesc-yuv422p12be 470f5361088e1af7f6ae70945d411a25
diff --git a/tests/ref/fate/filter-pixdesc-yuv422p12le b/tests/ref/fate/filter-pixdesc-yuv422p12le
new file mode 100644 (file)
index 0000000..e457288
--- /dev/null
@@ -0,0 +1 @@
+pixdesc-yuv422p12le dd79803aff3bf939c818304884341c17
index cc1e595..6ffeed0 100644 (file)
@@ -52,6 +52,8 @@ yuv420p9le          a0c9608b2be3ca6d4e8cf625714a3833
 yuv422p             b082344038849f5fd444ccf2a30e3f4f
 yuv422p10be         43a6293e138d0ecfd3385df3dcf9b713
 yuv422p10le         74da030a4efb5a20986fcead50018f4d
+yuv422p12be         d60480c872d6723e587199ee4ecfe86d
+yuv422p12le         2cbf87d44e9c897ec6460225d47efbda
 yuv422p16be         f7a0fb9e82805660317d07209e726100
 yuv422p16le         12eeb2f95bb0d655d52e8eed1cfbf771
 yuv422p9be          60daf1a7e61434b244c5a43f4449b617
index cc1e595..6ffeed0 100644 (file)
@@ -52,6 +52,8 @@ yuv420p9le          a0c9608b2be3ca6d4e8cf625714a3833
 yuv422p             b082344038849f5fd444ccf2a30e3f4f
 yuv422p10be         43a6293e138d0ecfd3385df3dcf9b713
 yuv422p10le         74da030a4efb5a20986fcead50018f4d
+yuv422p12be         d60480c872d6723e587199ee4ecfe86d
+yuv422p12le         2cbf87d44e9c897ec6460225d47efbda
 yuv422p16be         f7a0fb9e82805660317d07209e726100
 yuv422p16le         12eeb2f95bb0d655d52e8eed1cfbf771
 yuv422p9be          60daf1a7e61434b244c5a43f4449b617
index aa54675..a56d5c7 100644 (file)
@@ -52,6 +52,8 @@ yuv420p9le          38289963713431c8b4a2e7c08b8564b6
 yuv422p             66f47bfad422275bd07b2881760d09a2
 yuv422p10be         00504b09c67e203fc29cac3ae2aa91db
 yuv422p10le         b8b38a8d1f1eec3915b628c873bf756a
+yuv422p12be         0ab7660a9a52abe41edf8d6b3f75942a
+yuv422p12le         bde450e4b79a13aaaba8233df3c51f4d
 yuv422p16be         2f12b4fb816afcaa77e7359b95f25532
 yuv422p16le         3913bbbd4b0aa8038e8565c7312e25be
 yuv422p9be          f86744d026c3a65d54c737a93e80093f
index 29689db..9e7a916 100644 (file)
@@ -52,6 +52,8 @@ yuv420p9le          8248d1c10aa86ef8e4b212a2d9fca937
 yuv422p             5a58e1fe687b71e28f52aeb11b999e46
 yuv422p10be         adaf99408661a1dc3c667cad992c08d7
 yuv422p10le         bc071b965f5a1b3c7349b71bd2b4247c
+yuv422p12be         e1ab3898be486cd95e6332fa81570f63
+yuv422p12le         343a7281c6d30c09ed7b8be86bd6d42f
 yuv422p16be         1ec214fba454c456d83de5220c867ede
 yuv422p16le         9f9316d40597c9fb917d921bfbcd8421
 yuv422p9be          98e7cefa912845b488f85508a7be7e04