+#define PACK_Y210 GST_VIDEO_FORMAT_AYUV64, unpack_Y210, 1, pack_Y210
+static void
+unpack_Y210 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
+ gpointer dest, const gpointer data[GST_VIDEO_MAX_PLANES],
+ const gint stride[GST_VIDEO_MAX_PLANES], gint x, gint y, gint width)
+{
+ int i;
+ const guint8 *restrict s = GET_LINE (y);
+ guint16 *restrict d = dest;
+ guint Y0, Y1, U, V;
+
+ for (i = 0; i < width / 2; i++) {
+ Y0 = GST_READ_UINT16_LE (s + i * 8 + 0);
+ U = GST_READ_UINT16_LE (s + i * 8 + 2);
+ V = GST_READ_UINT16_LE (s + i * 8 + 6);
+ Y1 = GST_READ_UINT16_LE (s + i * 8 + 4);
+
+ if (!(flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)) {
+ Y0 |= (Y0 >> 10);
+ U |= (U >> 10);
+ V |= (V >> 10);
+ }
+
+ d[i * 8 + 0] = 0xffff;
+ d[i * 8 + 1] = Y0;
+ d[i * 8 + 2] = U;
+ d[i * 8 + 3] = V;
+
+ d[i * 8 + 4] = 0xffff;
+ d[i * 8 + 5] = Y1;
+ d[i * 8 + 6] = U;
+ d[i * 8 + 7] = V;
+ }
+}
+
+static void
+pack_Y210 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
+ const gpointer src, gint sstride, gpointer data[GST_VIDEO_MAX_PLANES],
+ const gint stride[GST_VIDEO_MAX_PLANES], GstVideoChromaSite chroma_site,
+ gint y, gint width)
+{
+ int i;
+ guint16 Y0, Y1, U, V;
+ guint8 *restrict d = GET_LINE (y);
+ const guint16 *restrict s = src;
+
+ for (i = 0; i < width; i += 2) {
+ Y0 = s[i * 4 + 1] & 0xffc0;
+ U = s[i * 4 + 2] & 0xffc0;
+ V = s[i * 4 + 3] & 0xffc0;
+ if (i == width - 1)
+ Y1 = s[i * 4 + 1] & 0xffc0;
+ else
+ Y1 = s[(i + 1) * 4 + 1] & 0xffc0;
+
+ GST_WRITE_UINT16_LE (d + i * 4 + 0, Y0);
+ GST_WRITE_UINT16_LE (d + i * 4 + 2, U);
+ GST_WRITE_UINT16_LE (d + i * 4 + 4, Y1);
+ GST_WRITE_UINT16_LE (d + i * 4 + 6, V);
+ }
+}
+