static void videoconvert_convert_generic (VideoConvert * convert,
GstVideoFrame * dest, const GstVideoFrame * src);
static void videoconvert_convert_lookup_fastpath (VideoConvert * convert);
-static void videoconvert_convert_lookup_getput (VideoConvert * convert);
+static void videoconvert_convert_lookup_matrix (VideoConvert * convert);
static void videoconvert_dither_none (VideoConvert * convert, int j);
static void videoconvert_dither_verterr (VideoConvert * convert, int j);
static void videoconvert_dither_halftone (VideoConvert * convert, int j);
}
videoconvert_convert_lookup_fastpath (convert);
- videoconvert_convert_lookup_getput (convert);
+ videoconvert_convert_lookup_matrix (convert);
convert->tmpline = g_malloc (sizeof (guint8) * (width + 8) * 4);
convert->tmpline16 = g_malloc (sizeof (guint16) * (width + 8) * 4);
convert->convert (convert, dest, src);
}
-/* Line conversion to AYUV */
-
-#define FRAME_GET_PLANE_STRIDE(frame, plane) \
- GST_VIDEO_FRAME_PLANE_STRIDE (frame, plane)
-#define FRAME_GET_PLANE_LINE(frame, plane, line) \
- (gpointer)(((guint8*)(GST_VIDEO_FRAME_PLANE_DATA (frame, plane))) + \
- FRAME_GET_PLANE_STRIDE (frame, plane) * (line))
-
-#define FRAME_GET_COMP_STRIDE(frame, comp) \
- GST_VIDEO_FRAME_COMP_STRIDE (frame, comp)
-#define FRAME_GET_COMP_LINE(frame, comp, line) \
- (gpointer)(((guint8*)(GST_VIDEO_FRAME_COMP_DATA (frame, comp))) + \
- FRAME_GET_COMP_STRIDE (frame, comp) * (line))
-
-#define FRAME_GET_STRIDE(frame) FRAME_GET_PLANE_STRIDE (frame, 0)
-#define FRAME_GET_LINE(frame,line) FRAME_GET_PLANE_LINE (frame, 0, line)
-
-#define FRAME_GET_Y_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_Y, line)
-#define FRAME_GET_U_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_U, line)
-#define FRAME_GET_V_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_V, line)
-#define FRAME_GET_A_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_A, line)
-
-#define FRAME_GET_Y_STRIDE(frame) FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_Y)
-#define FRAME_GET_U_STRIDE(frame) FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_U)
-#define FRAME_GET_V_STRIDE(frame) FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_V)
-#define FRAME_GET_A_STRIDE(frame) FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_A)
-
-static void
-getline_I420 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_I420 (dest,
- FRAME_GET_Y_LINE (src, j),
- FRAME_GET_U_LINE (src, j >> 1),
- FRAME_GET_V_LINE (src, j >> 1), convert->width);
-}
-
-static void
-putline_I420 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_I420 (FRAME_GET_Y_LINE (dest, j),
- FRAME_GET_U_LINE (dest, j >> 1),
- FRAME_GET_V_LINE (dest, j >> 1), src, convert->width / 2);
-}
-
-static void
-getline_YV12 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_I420 (dest,
- FRAME_GET_Y_LINE (src, j),
- FRAME_GET_U_LINE (src, j >> 1),
- FRAME_GET_V_LINE (src, j >> 1), convert->width);
-}
-
-static void
-putline_YV12 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_I420 (FRAME_GET_Y_LINE (dest, j),
- FRAME_GET_U_LINE (dest, j >> 1),
- FRAME_GET_V_LINE (dest, j >> 1), src, convert->width / 2);
-}
-
-static void
-getline_YUY2 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_YUY2 (dest, FRAME_GET_LINE (src, j), convert->width / 2);
-}
-
-static void
-putline_YUY2 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_YUY2 (FRAME_GET_LINE (dest, j), src, convert->width / 2);
-}
-
-static void
-getline_UYVY (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_UYVY (dest, FRAME_GET_LINE (src, j), convert->width / 2);
-}
-
-static void
-putline_UYVY (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_UYVY (FRAME_GET_LINE (dest, j), src, convert->width / 2);
-}
-
-static void
-getline_YVYU (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_YVYU (dest, FRAME_GET_LINE (src, j), convert->width / 2);
-}
-
-static void
-putline_YVYU (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_YVYU (FRAME_GET_LINE (dest, j), src, convert->width / 2);
-}
-
-static void
-getline_v308 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 1] = srcline[i * 3 + 0];
- dest[i * 4 + 2] = srcline[i * 3 + 1];
- dest[i * 4 + 3] = srcline[i * 3 + 2];
- }
-}
-
-static void
-putline_v308 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
- for (i = 0; i < convert->width; i++) {
- destline[i * 3 + 0] = src[i * 4 + 1];
- destline[i * 3 + 1] = src[i * 4 + 2];
- destline[i * 3 + 2] = src[i * 4 + 3];
- }
-}
-
-static void
-getline_AYUV (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- memcpy (dest, FRAME_GET_LINE (src, j), convert->width * 4);
-}
-
-static void
-putline_AYUV (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- memcpy (FRAME_GET_LINE (dest, j), src, convert->width * 4);
-}
-
-#if 0
-static void
-getline_v410 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = GST_READ_UINT16_LE (srcline + i * 8 + 0);
- dest[i * 4 + 1] = GST_READ_UINT16_LE (srcline + i * 8 + 2);
- dest[i * 4 + 2] = GST_READ_UINT16_LE (srcline + i * 8 + 4);
- dest[i * 4 + 3] = GST_READ_UINT16_LE (srcline + i * 8 + 6);
- }
-}
-#endif
-
-static void
-getline_v210 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
-
- for (i = 0; i < convert->width; i += 6) {
- guint32 a0, a1, a2, a3;
- guint16 y0, y1, y2, y3, y4, y5;
- guint16 u0, u2, u4;
- guint16 v0, v2, v4;
-
- a0 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 0);
- a1 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 4);
- a2 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 8);
- a3 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 12);
-
- u0 = ((a0 >> 0) & 0x3ff) >> 2;
- y0 = ((a0 >> 10) & 0x3ff) >> 2;
- v0 = ((a0 >> 20) & 0x3ff) >> 2;
- y1 = ((a1 >> 0) & 0x3ff) >> 2;
-
- u2 = ((a1 >> 10) & 0x3ff) >> 2;
- y2 = ((a1 >> 20) & 0x3ff) >> 2;
- v2 = ((a2 >> 0) & 0x3ff) >> 2;
- y3 = ((a2 >> 10) & 0x3ff) >> 2;
-
- u4 = ((a2 >> 20) & 0x3ff) >> 2;
- y4 = ((a3 >> 0) & 0x3ff) >> 2;
- v4 = ((a3 >> 10) & 0x3ff) >> 2;
- y5 = ((a3 >> 20) & 0x3ff) >> 2;
-
- dest[4 * (i + 0) + 0] = 0xff;
- dest[4 * (i + 0) + 1] = y0;
- dest[4 * (i + 0) + 2] = u0;
- dest[4 * (i + 0) + 3] = v0;
-
- dest[4 * (i + 1) + 0] = 0xff;
- dest[4 * (i + 1) + 1] = y1;
- dest[4 * (i + 1) + 2] = u0;
- dest[4 * (i + 1) + 3] = v0;
-
- dest[4 * (i + 2) + 0] = 0xff;
- dest[4 * (i + 2) + 1] = y2;
- dest[4 * (i + 2) + 2] = u2;
- dest[4 * (i + 2) + 3] = v2;
-
- dest[4 * (i + 3) + 0] = 0xff;
- dest[4 * (i + 3) + 1] = y3;
- dest[4 * (i + 3) + 2] = u2;
- dest[4 * (i + 3) + 3] = v2;
-
- dest[4 * (i + 4) + 0] = 0xff;
- dest[4 * (i + 4) + 1] = y4;
- dest[4 * (i + 4) + 2] = u4;
- dest[4 * (i + 4) + 3] = v4;
-
- dest[4 * (i + 5) + 0] = 0xff;
- dest[4 * (i + 5) + 1] = y5;
- dest[4 * (i + 5) + 2] = u4;
- dest[4 * (i + 5) + 3] = v4;
-
- }
-
-}
-
-static void
-putline_v210 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
-
- for (i = 0; i < convert->width; i += 6) {
- guint32 a0, a1, a2, a3;
- guint16 y0, y1, y2, y3, y4, y5;
- guint16 u0, u1, u2;
- guint16 v0, v1, v2;
-
- y0 = src[4 * (i + 0) + 1] << 2;
- y1 = src[4 * (i + 1) + 1] << 2;
- y2 = src[4 * (i + 2) + 1] << 2;
- y3 = src[4 * (i + 3) + 1] << 2;
- y4 = src[4 * (i + 4) + 1] << 2;
- y5 = src[4 * (i + 5) + 1] << 2;
-
- u0 = (src[4 * (i + 0) + 2] + src[4 * (i + 1) + 2]) << 1;
- u1 = (src[4 * (i + 2) + 2] + src[4 * (i + 3) + 2]) << 1;
- u2 = (src[4 * (i + 4) + 2] + src[4 * (i + 5) + 2]) << 1;
-
- v0 = (src[4 * (i + 0) + 3] + src[4 * (i + 1) + 3]) << 1;
- v1 = (src[4 * (i + 2) + 3] + src[4 * (i + 3) + 3]) << 1;
- v2 = (src[4 * (i + 4) + 3] + src[4 * (i + 5) + 3]) << 1;
-
- a0 = u0 | (y0 << 10) | (v0 << 20);
- a1 = y1 | (u1 << 10) | (y2 << 20);
- a2 = v1 | (y3 << 10) | (u2 << 20);
- a3 = y4 | (v2 << 10) | (y5 << 20);
-
- GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 0, a0);
- GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 4, a1);
- GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 8, a2);
- GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 12, a3);
- }
-}
-
-static void
-getline16_v210 (VideoConvert * convert, guint16 * dest,
- const GstVideoFrame * src, int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
-
- for (i = 0; i < convert->width; i += 6) {
- guint32 a0, a1, a2, a3;
- guint16 y0, y1, y2, y3, y4, y5;
- guint16 u0, u2, u4;
- guint16 v0, v2, v4;
-
- a0 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 0);
- a1 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 4);
- a2 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 8);
- a3 = GST_READ_UINT32_LE (srcline + (i / 6) * 16 + 12);
-
- u0 = ((a0 >> 0) & 0x3ff) << 6;
- y0 = ((a0 >> 10) & 0x3ff) << 6;
- v0 = ((a0 >> 20) & 0x3ff) << 6;
- y1 = ((a1 >> 0) & 0x3ff) << 6;
-
- u2 = ((a1 >> 10) & 0x3ff) << 6;
- y2 = ((a1 >> 20) & 0x3ff) << 6;
- v2 = ((a2 >> 0) & 0x3ff) << 6;
- y3 = ((a2 >> 10) & 0x3ff) << 6;
-
- u4 = ((a2 >> 20) & 0x3ff) << 6;
- y4 = ((a3 >> 0) & 0x3ff) << 6;
- v4 = ((a3 >> 10) & 0x3ff) << 6;
- y5 = ((a3 >> 20) & 0x3ff) << 6;
-
- dest[4 * (i + 0) + 0] = 0xffff;
- dest[4 * (i + 0) + 1] = y0;
- dest[4 * (i + 0) + 2] = u0;
- dest[4 * (i + 0) + 3] = v0;
-
- dest[4 * (i + 1) + 0] = 0xffff;
- dest[4 * (i + 1) + 1] = y1;
- dest[4 * (i + 1) + 2] = u0;
- dest[4 * (i + 1) + 3] = v0;
-
- dest[4 * (i + 2) + 0] = 0xffff;
- dest[4 * (i + 2) + 1] = y2;
- dest[4 * (i + 2) + 2] = u2;
- dest[4 * (i + 2) + 3] = v2;
-
- dest[4 * (i + 3) + 0] = 0xffff;
- dest[4 * (i + 3) + 1] = y3;
- dest[4 * (i + 3) + 2] = u2;
- dest[4 * (i + 3) + 3] = v2;
-
- dest[4 * (i + 4) + 0] = 0xffff;
- dest[4 * (i + 4) + 1] = y4;
- dest[4 * (i + 4) + 2] = u4;
- dest[4 * (i + 4) + 3] = v4;
-
- dest[4 * (i + 5) + 0] = 0xffff;
- dest[4 * (i + 5) + 1] = y5;
- dest[4 * (i + 5) + 2] = u4;
- dest[4 * (i + 5) + 3] = v4;
-
- }
-}
-
-static void
-putline16_v210 (VideoConvert * convert, GstVideoFrame * dest,
- const guint16 * src, int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
-
- for (i = 0; i < convert->width; i += 6) {
- guint32 a0, a1, a2, a3;
- guint16 y0, y1, y2, y3, y4, y5;
- guint16 u0, u1, u2;
- guint16 v0, v1, v2;
-
- y0 = src[4 * (i + 0) + 1] >> 6;
- y1 = src[4 * (i + 1) + 1] >> 6;
- y2 = src[4 * (i + 2) + 1] >> 6;
- y3 = src[4 * (i + 3) + 1] >> 6;
- y4 = src[4 * (i + 4) + 1] >> 6;
- y5 = src[4 * (i + 5) + 1] >> 6;
-
- u0 = (src[4 * (i + 0) + 2] + src[4 * (i + 1) + 2] + 1) >> 7;
- u1 = (src[4 * (i + 2) + 2] + src[4 * (i + 3) + 2] + 1) >> 7;
- u2 = (src[4 * (i + 4) + 2] + src[4 * (i + 5) + 2] + 1) >> 7;
-
- v0 = (src[4 * (i + 0) + 3] + src[4 * (i + 1) + 3] + 1) >> 7;
- v1 = (src[4 * (i + 2) + 3] + src[4 * (i + 3) + 3] + 1) >> 7;
- v2 = (src[4 * (i + 4) + 3] + src[4 * (i + 5) + 3] + 1) >> 7;
-
- a0 = u0 | (y0 << 10) | (v0 << 20);
- a1 = y1 | (u1 << 10) | (y2 << 20);
- a2 = v1 | (y3 << 10) | (u2 << 20);
- a3 = y4 | (v2 << 10) | (y5 << 20);
-
- GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 0, a0);
- GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 4, a1);
- GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 8, a2);
- GST_WRITE_UINT32_LE (destline + (i / 6) * 16 + 12, a3);
- }
-}
-
-static void
-getline_v216 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 1] = GST_READ_UINT16_LE (srcline + i * 4 + 2) >> 8;
- dest[i * 4 + 2] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 0) >> 8;
- dest[i * 4 + 3] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 4) >> 8;
- }
-}
-
-static void
-putline_v216 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
- for (i = 0; i < convert->width / 2; i++) {
- GST_WRITE_UINT16_LE (destline + i * 8 + 0, src[(i * 2 + 0) * 4 + 2] << 8);
- GST_WRITE_UINT16_LE (destline + i * 8 + 2, src[(i * 2 + 0) * 4 + 1] << 8);
- GST_WRITE_UINT16_LE (destline + i * 8 + 4, src[(i * 2 + 0) * 4 + 3] << 8);
- GST_WRITE_UINT16_LE (destline + i * 8 + 6, src[(i * 2 + 1) * 4 + 1] << 8);
- }
-}
-
-static void
-getline16_v216 (VideoConvert * convert, guint16 * dest,
- const GstVideoFrame * src, int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xffff;
- dest[i * 4 + 1] = GST_READ_UINT16_LE (srcline + i * 4 + 2);
- dest[i * 4 + 2] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 0);
- dest[i * 4 + 3] = GST_READ_UINT16_LE (srcline + (i >> 1) * 8 + 4);
- }
-}
-
-static void
-putline16_v216 (VideoConvert * convert, GstVideoFrame * dest,
- const guint16 * src, int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
- for (i = 0; i < convert->width / 2; i++) {
- GST_WRITE_UINT16_LE (destline + i * 8 + 0, src[(i * 2 + 0) * 4 + 2]);
- GST_WRITE_UINT16_LE (destline + i * 8 + 2, src[(i * 2 + 0) * 4 + 1]);
- GST_WRITE_UINT16_LE (destline + i * 8 + 4, src[(i * 2 + 0) * 4 + 3]);
- GST_WRITE_UINT16_LE (destline + i * 8 + 6, src[(i * 2 + 1) * 4 + 1]);
- }
-}
-
-static void
-getline_Y41B (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_YUV9 (dest,
- FRAME_GET_Y_LINE (src, j),
- FRAME_GET_U_LINE (src, j), FRAME_GET_V_LINE (src, j), convert->width / 2);
-}
-
-static void
-putline_Y41B (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint8 *destlineY = FRAME_GET_Y_LINE (dest, j);
- guint8 *destlineU = FRAME_GET_U_LINE (dest, j);
- guint8 *destlineV = FRAME_GET_V_LINE (dest, j);
-
- for (i = 0; i < convert->width - 3; i += 4) {
- destlineY[i] = src[i * 4 + 1];
- destlineY[i + 1] = src[i * 4 + 5];
- destlineY[i + 2] = src[i * 4 + 9];
- destlineY[i + 3] = src[i * 4 + 13];
-
- destlineU[i >> 2] =
- (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + src[i * 4 + 14] +
- 2) >> 2;
- destlineV[i >> 2] =
- (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + src[i * 4 + 15] +
- 2) >> 2;
- }
-
- if (i == convert->width - 3) {
- destlineY[i] = src[i * 4 + 1];
- destlineY[i + 1] = src[i * 4 + 5];
- destlineY[i + 2] = src[i * 4 + 9];
-
- destlineU[i >> 2] =
- (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + 1) / 3;
- destlineV[i >> 2] =
- (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + 1) / 3;
- } else if (i == convert->width - 2) {
- destlineY[i] = src[i * 4 + 1];
- destlineY[i + 1] = src[i * 4 + 5];
-
- destlineU[i >> 2] = (src[i * 4 + 2] + src[i * 4 + 6] + 1) >> 1;
- destlineV[i >> 2] = (src[i * 4 + 3] + src[i * 4 + 7] + 1) >> 1;
- } else if (i == convert->width - 1) {
- destlineY[i + 1] = src[i * 4 + 5];
-
- destlineU[i >> 2] = src[i * 4 + 2];
- destlineV[i >> 2] = src[i * 4 + 3];
- }
-}
-
-static void
-getline_Y42B (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_Y42B (dest,
- FRAME_GET_Y_LINE (src, j),
- FRAME_GET_U_LINE (src, j), FRAME_GET_V_LINE (src, j), convert->width / 2);
-}
-
-static void
-putline_Y42B (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_Y42B (FRAME_GET_Y_LINE (dest, j),
- FRAME_GET_U_LINE (dest, j),
- FRAME_GET_V_LINE (dest, j), src, convert->width / 2);
-}
-
-static void
-getline_Y444 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_Y444 (dest,
- FRAME_GET_Y_LINE (src, j),
- FRAME_GET_U_LINE (src, j), FRAME_GET_V_LINE (src, j), convert->width);
-}
-
-static void
-putline_Y444 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_Y444 (FRAME_GET_Y_LINE (dest, j),
- FRAME_GET_U_LINE (dest, j),
- FRAME_GET_V_LINE (dest, j), src, convert->width);
-}
-
-static void
-getline_GRAY8 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_Y800 (dest, FRAME_GET_LINE (src, j), convert->width);
-}
-
-static void
-putline_GRAY8 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_Y800 (FRAME_GET_LINE (dest, j), src, convert->width);
-}
-
-static void
-getline_GRAY16_LE (VideoConvert * convert, guint8 * dest,
- const GstVideoFrame * src, int j)
-{
- cogorc_getline_Y16 (dest, FRAME_GET_LINE (src, j), convert->width);
-}
-
-static void
-putline_GRAY16_LE (VideoConvert * convert, GstVideoFrame * dest,
- const guint8 * src, int j)
-{
- cogorc_putline_Y16 (FRAME_GET_LINE (dest, j), src, convert->width);
-}
-
-static void
-getline_RGB16 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint16 *srcline = FRAME_GET_LINE (src, j);
-
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 1] = ((srcline[i] >> 11) & 0x1f) << 3;
- dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x3f) << 2;
- dest[i * 4 + 3] = ((srcline[i]) & 0x1f) << 3;
- }
-}
-
-static void
-putline_RGB16 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint16 *destline = FRAME_GET_LINE (dest, j);
-
- for (i = 0; i < convert->width; i++) {
- destline[i] =
- ((src[i * 4 + 1] >> 3) << 11) | ((src[i * 4 +
- 2] >> 2) << 5) | (src[i * 4 + 3] >> 3);
- }
-}
-
-static void
-getline_BGR16 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint16 *srcline = FRAME_GET_LINE (src, j);
-
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 3] = ((srcline[i] >> 11) & 0x1f) << 3;
- dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x3f) << 2;
- dest[i * 4 + 1] = ((srcline[i]) & 0x1f) << 3;
- }
-}
-
-static void
-putline_BGR16 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint16 *destline = FRAME_GET_LINE (dest, j);
-
- for (i = 0; i < convert->width; i++) {
- destline[i] =
- ((src[i * 4 + 3] >> 3) << 11) | ((src[i * 4 +
- 2] >> 2) << 5) | (src[i * 4 + 1] >> 3);
- }
-}
-
-static void
-getline_RGB15 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint16 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 1] = ((srcline[i] >> 10) & 0x1f) << 3;
- dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x1f) << 3;
- dest[i * 4 + 3] = ((srcline[i]) & 0x1f) << 3;
- }
-}
-
-static void
-putline_RGB15 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint16 *destline = FRAME_GET_LINE (dest, j);
- for (i = 0; i < convert->width; i++) {
- destline[i] =
- ((src[i * 4 + 1] >> 3) << 10) | ((src[i * 4 +
- 2] >> 3) << 5) | (src[i * 4 + 3] >> 3);
- }
-}
-
-static void
-getline_BGR15 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint16 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 3] = ((srcline[i] >> 10) & 0x1f) << 3;
- dest[i * 4 + 2] = ((srcline[i] >> 5) & 0x1f) << 3;
- dest[i * 4 + 1] = ((srcline[i]) & 0x1f) << 3;
- }
-}
-
-static void
-putline_BGR15 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint16 *destline = FRAME_GET_LINE (dest, j);
- for (i = 0; i < convert->width; i++) {
- destline[i] =
- ((src[i * 4 + 3] >> 3) << 10) | ((src[i * 4 +
- 2] >> 3) << 5) | (src[i * 4 + 1] >> 3);
- }
-}
-
-static void
-getline_BGRA (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_BGRA (dest, FRAME_GET_LINE (src, j), convert->width);
-}
-
-static void
-putline_BGRA (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_BGRA (FRAME_GET_LINE (dest, j), src, convert->width);
-}
-
-static void
-getline_ABGR (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_ABGR (dest, FRAME_GET_LINE (src, j), convert->width);
-}
-
-static void
-putline_ABGR (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_ABGR (FRAME_GET_LINE (dest, j), src, convert->width);
-}
-
-static void
-getline_RGBA (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_RGBA (dest, FRAME_GET_LINE (src, j), convert->width);
-}
-
-static void
-putline_RGBA (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_RGBA (FRAME_GET_LINE (dest, j), src, convert->width);
-}
-
-static void
-getline_RGB (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
-
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 1] = srcline[i * 3 + 0];
- dest[i * 4 + 2] = srcline[i * 3 + 1];
- dest[i * 4 + 3] = srcline[i * 3 + 2];
- }
-}
-
-static void
-putline_RGB (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
- for (i = 0; i < convert->width; i++) {
- destline[i * 3 + 0] = src[i * 4 + 1];
- destline[i * 3 + 1] = src[i * 4 + 2];
- destline[i * 3 + 2] = src[i * 4 + 3];
- }
-}
-
-static void
-getline_BGR (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 1] = srcline[i * 3 + 2];
- dest[i * 4 + 2] = srcline[i * 3 + 1];
- dest[i * 4 + 3] = srcline[i * 3 + 0];
- }
-}
-
-static void
-putline_BGR (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
- for (i = 0; i < convert->width; i++) {
- destline[i * 3 + 0] = src[i * 4 + 3];
- destline[i * 3 + 1] = src[i * 4 + 2];
- destline[i * 3 + 2] = src[i * 4 + 1];
- }
-}
-
-static void
-getline_NV12 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_NV12 (dest,
- FRAME_GET_PLANE_LINE (src, 0, j),
- FRAME_GET_PLANE_LINE (src, 1, j >> 1), convert->width / 2);
-}
-
-static void
-putline_NV12 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_NV12 (FRAME_GET_PLANE_LINE (dest, 0, j),
- FRAME_GET_PLANE_LINE (dest, 1, j >> 1), src, convert->width / 2);
-}
-
-static void
-getline_NV21 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_NV21 (dest,
- FRAME_GET_PLANE_LINE (src, 0, j),
- FRAME_GET_PLANE_LINE (src, 1, j >> 1), convert->width / 2);
-}
-
-static void
-putline_NV21 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_NV21 (FRAME_GET_PLANE_LINE (dest, 0, j),
- FRAME_GET_PLANE_LINE (dest, 1, j >> 1), src, convert->width / 2);
-}
-
-static void
-getline_UYVP (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width; i += 2) {
- guint16 y0, y1;
- guint16 u0;
- guint16 v0;
-
- u0 = (srcline[(i / 2) * 5 + 0] << 2) | (srcline[(i / 2) * 5 + 1] >> 6);
- y0 = ((srcline[(i / 2) * 5 + 1] & 0x3f) << 4) | (srcline[(i / 2) * 5 +
- 2] >> 4);
- v0 = ((srcline[(i / 2) * 5 + 2] & 0x0f) << 6) | (srcline[(i / 2) * 5 +
- 3] >> 2);
- y1 = ((srcline[(i / 2) * 5 + 3] & 0x03) << 8) | srcline[(i / 2) * 5 + 4];
-
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 1] = y0 >> 2;
- dest[i * 4 + 2] = u0 >> 2;
- dest[i * 4 + 3] = v0 >> 2;
- dest[i * 4 + 4] = 0xff;
- dest[i * 4 + 5] = y1 >> 2;
- dest[i * 4 + 6] = u0 >> 2;
- dest[i * 4 + 7] = v0 >> 2;
- }
-}
-
-static void
-putline_UYVP (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
- for (i = 0; i < convert->width; i += 2) {
- guint16 y0, y1;
- guint16 u0;
- guint16 v0;
-
- y0 = src[4 * (i + 0) + 1];
- y1 = src[4 * (i + 1) + 1];
- u0 = (src[4 * (i + 0) + 2] + src[4 * (i + 1) + 2] + 1) >> 1;
- v0 = (src[4 * (i + 0) + 3] + src[4 * (i + 1) + 3] + 1) >> 1;
-
- destline[(i / 2) * 5 + 0] = u0;
- destline[(i / 2) * 5 + 1] = y0 >> 2;
- destline[(i / 2) * 5 + 2] = (y0 << 6) | (v0 >> 4);
- destline[(i / 2) * 5 + 3] = (v0 << 4) | (y1 >> 6);
- destline[(i / 2) * 5 + 4] = (y1 << 2);
- }
-}
-
-static void
-getline_A420 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_A420 (dest,
- FRAME_GET_Y_LINE (src, j),
- FRAME_GET_U_LINE (src, j >> 1),
- FRAME_GET_V_LINE (src, j >> 1),
- FRAME_GET_A_LINE (src, j), convert->width);
-}
-
-static void
-putline_A420 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- cogorc_putline_A420 (FRAME_GET_Y_LINE (dest, j),
- FRAME_GET_U_LINE (dest, j >> 1),
- FRAME_GET_V_LINE (dest, j >> 1),
- FRAME_GET_A_LINE (dest, j), src, convert->width / 2);
-}
-
-static void
-getline_RGB8P (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width; i++) {
- guint32 v = convert->palette[srcline[i]];
- dest[i * 4 + 0] = (v >> 24) & 0xff;
- dest[i * 4 + 1] = (v >> 16) & 0xff;
- dest[i * 4 + 2] = (v >> 8) & 0xff;
- dest[i * 4 + 3] = (v) & 0xff;
- }
-}
-
-static void
-putline_RGB8P (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
- /* Use our poor man's palette, taken from ffmpegcolorspace too */
- for (i = 0; i < convert->width; i++) {
- /* crude approximation for alpha ! */
- if (src[i * 4 + 0] < 0x80)
- destline[i] = 6 * 6 * 6;
- else
- destline[i] =
- ((((src[i * 4 + 1]) / 47) % 6) * 6 * 6 + (((src[i * 4 +
- 2]) / 47) % 6) * 6 + (((src[i * 4 + 3]) / 47) % 6));
- }
-}
-
-
-static void
-getline_YUV9 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- cogorc_getline_YUV9 (dest,
- FRAME_GET_Y_LINE (src, j),
- FRAME_GET_U_LINE (src, j >> 2),
- FRAME_GET_V_LINE (src, j >> 2), convert->width / 2);
-}
-
-static void
-putline_YUV9 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint8 *destY = FRAME_GET_Y_LINE (dest, j);
- guint8 *destU = FRAME_GET_U_LINE (dest, j >> 2);
- guint8 *destV = FRAME_GET_V_LINE (dest, j >> 2);
-
- for (i = 0; i < convert->width - 3; i += 4) {
- destY[i] = src[i * 4 + 1];
- destY[i + 1] = src[i * 4 + 5];
- destY[i + 2] = src[i * 4 + 9];
- destY[i + 3] = src[i * 4 + 13];
- if (j % 4 == 0) {
- destU[i >> 2] =
- (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + src[i * 4 +
- 14]) >> 2;
- destV[i >> 2] =
- (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + src[i * 4 +
- 15]) >> 2;
- }
- }
-
- if (i == convert->width - 3) {
- destY[i] = src[i * 4 + 1];
- destY[i + 1] = src[i * 4 + 5];
- destY[i + 2] = src[i * 4 + 9];
- if (j % 4 == 0) {
- destU[i >> 2] = (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10]) / 3;
- destV[i >> 2] = (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11]) / 3;
- }
- } else if (i == convert->width - 2) {
- destY[i] = src[i * 4 + 1];
- destY[i + 1] = src[i * 4 + 5];
- if (j % 4 == 0) {
- destU[i >> 2] = (src[i * 4 + 2] + src[i * 4 + 6]) >> 1;
- destV[i >> 2] = (src[i * 4 + 3] + src[i * 4 + 7]) >> 1;
- }
- } else if (i == convert->width - 1) {
- destY[i] = src[i * 4 + 1];
- destU[i >> 2] = src[i * 4 + 2];
- destV[i >> 2] = src[i * 4 + 3];
- }
-}
-
-static void
-getline_IYU1 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
-
- for (i = 0; i < convert->width - 3; i += 4) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 4] = 0xff;
- dest[i * 4 + 8] = 0xff;
- dest[i * 4 + 12] = 0xff;
- dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
- dest[i * 4 + 5] = srcline[(i >> 2) * 6 + 2];
- dest[i * 4 + 9] = srcline[(i >> 2) * 6 + 4];
- dest[i * 4 + 13] = srcline[(i >> 2) * 6 + 5];
- dest[i * 4 + 2] = dest[i * 4 + 6] = dest[i * 4 + 10] = dest[i * 4 + 14] =
- srcline[(i >> 2) * 6 + 0];
- dest[i * 4 + 3] = dest[i * 4 + 7] = dest[i * 4 + 11] = dest[i * 4 + 15] =
- srcline[(i >> 2) * 6 + 3];
- }
-
- if (i == convert->width - 3) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 4] = 0xff;
- dest[i * 4 + 8] = 0xff;
- dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
- dest[i * 4 + 5] = srcline[(i >> 2) * 6 + 2];
- dest[i * 4 + 9] = srcline[(i >> 2) * 6 + 4];
- dest[i * 4 + 2] = dest[i * 4 + 6] = dest[i * 4 + 10] =
- srcline[(i >> 2) * 6 + 0];
- dest[i * 4 + 3] = dest[i * 4 + 7] = dest[i * 4 + 11] =
- srcline[(i >> 2) * 6 + 3];
- } else if (i == convert->width - 2) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 4] = 0xff;
- dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
- dest[i * 4 + 5] = srcline[(i >> 2) * 6 + 2];
- dest[i * 4 + 2] = dest[i * 4 + 6] = srcline[(i >> 2) * 6 + 0];
- dest[i * 4 + 3] = dest[i * 4 + 7] = srcline[(i >> 2) * 6 + 3];
- } else if (i == convert->width - 1) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 1] = srcline[(i >> 2) * 6 + 1];
- dest[i * 4 + 2] = srcline[(i >> 2) * 6 + 0];
- dest[i * 4 + 3] = srcline[(i >> 2) * 6 + 3];
- }
-}
-
-static void
-putline_IYU1 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
-
- for (i = 0; i < convert->width - 3; i += 4) {
- destline[(i >> 2) * 6 + 1] = src[i * 4 + 1];
- destline[(i >> 2) * 6 + 2] = src[i * 4 + 5];
- destline[(i >> 2) * 6 + 4] = src[i * 4 + 9];
- destline[(i >> 2) * 6 + 5] = src[i * 4 + 13];
- destline[(i >> 2) * 6 + 0] =
- (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10] + src[i * 4 +
- 14]) >> 2;
- destline[(i >> 2) * 6 + 3] =
- (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11] + src[i * 4 +
- 15]) >> 2;
- }
-
- if (i == convert->width - 3) {
- destline[(i >> 2) * 6 + 1] = src[i * 4 + 1];
- destline[(i >> 2) * 6 + 2] = src[i * 4 + 5];
- destline[(i >> 2) * 6 + 4] = src[i * 4 + 9];
- destline[(i >> 2) * 6 + 0] =
- (src[i * 4 + 2] + src[i * 4 + 6] + src[i * 4 + 10]) / 3;
- destline[(i >> 2) * 6 + 3] =
- (src[i * 4 + 3] + src[i * 4 + 7] + src[i * 4 + 11]) / 3;
- } else if (i == convert->width - 2) {
- destline[(i >> 2) * 6 + 1] = src[i * 4 + 1];
- destline[(i >> 2) * 6 + 2] = src[i * 4 + 5];
- destline[(i >> 2) * 6 + 0] = (src[i * 4 + 2] + src[i * 4 + 6]) >> 1;
- destline[(i >> 2) * 6 + 3] = (src[i * 4 + 3] + src[i * 4 + 7]) >> 1;
- } else if (i == convert->width - 1) {
- destline[(i >> 2) * 6 + 1] = src[i * 4 + 1];
- destline[(i >> 2) * 6 + 0] = src[i * 4 + 2];
- destline[(i >> 2) * 6 + 3] = src[i * 4 + 3];
- }
-}
-
-static void
-getline_AY64 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint16 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width * 4; i++) {
- dest[i] = srcline[i] >> 8;
- }
-}
-
-static void
-putline_AY64 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint16 *destline = FRAME_GET_LINE (dest, j);
- for (i = 0; i < convert->width * 4; i++) {
- destline[i] = src[i] << 8;
- }
-}
-
-static void
-getline16_AY64 (VideoConvert * convert, guint16 * dest,
- const GstVideoFrame * src, int j)
-{
- memcpy (dest, FRAME_GET_LINE (src, j), convert->width * 8);
-}
-
-static void
-putline16_AY64 (VideoConvert * convert, GstVideoFrame * dest,
- const guint16 * src, int j)
-{
- memcpy (FRAME_GET_LINE (dest, j), src, convert->width * 8);
-}
-
-static void
-getline_r210 (VideoConvert * convert, guint8 * dest, const GstVideoFrame * src,
- int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width; i++) {
- guint8 x;
- dest[i * 4 + 0] = 0xff;
- x = GST_READ_UINT32_BE (srcline + i * 4);
- dest[i * 4 + 1] = (x >> 22) & 0xff;
- dest[i * 4 + 2] = (x >> 12) & 0xff;
- dest[i * 4 + 3] = (x >> 2) & 0xff;
- }
-}
-
-static void
-putline_r210 (VideoConvert * convert, GstVideoFrame * dest, const guint8 * src,
- int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
- for (i = 0; i < convert->width / 2; i++) {
- guint32 x = 0;
- x |= src[i * 4 + 1] << 22;
- x |= (src[i * 4 + 1] & 0xc0) << 14;
- x |= src[i * 4 + 2] << 12;
- x |= (src[i * 4 + 2] & 0xc0) << 10;
- x |= src[i * 4 + 3] << 2;
- x |= (src[i * 4 + 3] & 0xc0) >> 6;
- GST_WRITE_UINT32_BE (destline + i * 4, x);
- }
-}
-
-static void
-getline16_r210 (VideoConvert * convert, guint16 * dest,
- const GstVideoFrame * src, int j)
-{
- int i;
- const guint8 *srcline = FRAME_GET_LINE (src, j);
- for (i = 0; i < convert->width; i++) {
- guint32 x;
- dest[i * 4 + 0] = 0xffff;
- x = GST_READ_UINT32_BE (srcline + i * 4);
- dest[i * 4 + 1] = ((x >> 14) & 0xffc0) | (x >> 24);
- dest[i * 4 + 2] = ((x >> 4) & 0xffc0) | ((x >> 14) & 0x3f);
- dest[i * 4 + 3] = ((x << 6) & 0xffc0) | ((x >> 4) & 0x3f);
- }
-}
-
-static void
-putline16_r210 (VideoConvert * convert, GstVideoFrame * dest,
- const guint16 * src, int j)
-{
- int i;
- guint8 *destline = FRAME_GET_LINE (dest, j);
- for (i = 0; i < convert->width; i++) {
- guint32 x = 0;
- x |= (src[i * 4 + 1] & 0xffc0) << 14;
- x |= (src[i * 4 + 2] & 0xffc0) << 4;
- x |= (src[i * 4 + 3] & 0xffc0) >> 6;
- GST_WRITE_UINT32_BE (destline + i * 4, x);
- }
-}
-
-static void
-getline_I420_10LE (VideoConvert * convert, guint8 * dest,
- const GstVideoFrame * src, int j)
-{
- int i;
- guint16 *srcY = FRAME_GET_Y_LINE (src, j);
- guint16 *srcU = FRAME_GET_U_LINE (src, j >> 1);
- guint16 *srcV = FRAME_GET_V_LINE (src, j >> 1);
-
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 1] = GST_READ_UINT16_LE (srcY + i) >> 2;
- dest[i * 4 + 2] = GST_READ_UINT16_LE (srcU + (i >> 1)) >> 2;
- dest[i * 4 + 3] = GST_READ_UINT16_LE (srcV + (i >> 1)) >> 2;
- }
-}
-
-static void
-putline_I420_10LE (VideoConvert * convert, GstVideoFrame * dest,
- const guint8 * src, int j)
-{
- int i;
- guint16 *destY = FRAME_GET_Y_LINE (dest, j);
- guint16 *destU = FRAME_GET_U_LINE (dest, j >> 1);
- guint16 *destV = FRAME_GET_V_LINE (dest, j >> 1);
- guint16 Y0, Y1, U, V;
-
- for (i = 0; i < convert->width - 1; i += 2) {
- Y0 = (src[i * 4 + 1]) << 2;
- Y1 = (src[i * 4 + 5]) << 2;
- U = ((src[i * 4 + 2] + src[i * 4 + 6] + 1) >> 1) << 2;
- V = ((src[i * 4 + 3] + src[i * 4 + 7] + 1) >> 1) << 2;
-
- GST_WRITE_UINT16_LE (destY + i + 0, Y0);
- GST_WRITE_UINT16_LE (destY + i + 1, Y1);
- GST_WRITE_UINT16_LE (destU + (i >> 1), U);
- GST_WRITE_UINT16_LE (destV + (i >> 1), V);
- }
- if (i == convert->width - 1) {
- Y0 = src[i * 4 + 1] << 2;
- U = src[i * 4 + 2] << 2;
- V = src[i * 4 + 3] << 2;
-
- GST_WRITE_UINT16_LE (destY + i, Y0);
- GST_WRITE_UINT16_LE (destU + (i >> 1), U);
- GST_WRITE_UINT16_LE (destV + (i >> 1), V);
- }
-}
-
-static void
-getline_I420_10BE (VideoConvert * convert, guint8 * dest,
- const GstVideoFrame * src, int j)
-{
- int i;
- guint16 *srcY = FRAME_GET_Y_LINE (src, j);
- guint16 *srcU = FRAME_GET_U_LINE (src, j >> 1);
- guint16 *srcV = FRAME_GET_V_LINE (src, j >> 1);
-
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xff;
- dest[i * 4 + 1] = GST_READ_UINT16_BE (srcY + i) >> 2;
- dest[i * 4 + 2] = GST_READ_UINT16_BE (srcU + (i >> 1)) >> 2;
- dest[i * 4 + 3] = GST_READ_UINT16_BE (srcV + (i >> 1)) >> 2;
- }
-}
-
-static void
-putline_I420_10BE (VideoConvert * convert, GstVideoFrame * dest,
- const guint8 * src, int j)
-{
- int i;
- guint16 *destY = FRAME_GET_Y_LINE (dest, j);
- guint16 *destU = FRAME_GET_U_LINE (dest, j >> 1);
- guint16 *destV = FRAME_GET_V_LINE (dest, j >> 1);
- guint16 Y0, Y1, U, V;
-
- for (i = 0; i < convert->width - 1; i += 2) {
- Y0 = src[i * 4 + 1] << 2;
- Y1 = src[i * 4 + 5] << 2;
- U = ((src[i * 4 + 2] + src[i * 4 + 6] + 1) >> 1) << 2;
- V = ((src[i * 4 + 3] + src[i * 4 + 7] + 1) >> 1) << 2;
-
- GST_WRITE_UINT16_BE (destY + i + 0, Y0);
- GST_WRITE_UINT16_BE (destY + i + 1, Y1);
- GST_WRITE_UINT16_BE (destU + (i >> 1), U);
- GST_WRITE_UINT16_BE (destV + (i >> 1), V);
- }
- if (i == convert->width - 1) {
- Y0 = src[i * 4 + 1] << 2;
- U = src[i * 4 + 2] << 2;
- V = src[i * 4 + 3] << 2;
-
- GST_WRITE_UINT16_BE (destY + i, Y0);
- GST_WRITE_UINT16_BE (destU + (i >> 1), U);
- GST_WRITE_UINT16_BE (destV + (i >> 1), V);
- }
-}
-
-static void
-getline16_I420_10LE (VideoConvert * convert, guint16 * dest,
- const GstVideoFrame * src, int j)
-{
- int i;
- guint16 *srcY = FRAME_GET_Y_LINE (src, j);
- guint16 *srcU = FRAME_GET_U_LINE (src, j >> 1);
- guint16 *srcV = FRAME_GET_V_LINE (src, j >> 1);
-
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xffff;
- dest[i * 4 + 1] = GST_READ_UINT16_LE (srcY + i) << 6;
- dest[i * 4 + 2] = GST_READ_UINT16_LE (srcU + (i >> 1)) << 6;
- dest[i * 4 + 3] = GST_READ_UINT16_LE (srcV + (i >> 1)) << 6;
- }
-}
-
-static void
-putline16_I420_10LE (VideoConvert * convert, GstVideoFrame * dest,
- const guint16 * src, int j)
-{
- int i;
- guint16 *destY = FRAME_GET_Y_LINE (dest, j);
- guint16 *destU = FRAME_GET_U_LINE (dest, j >> 1);
- guint16 *destV = FRAME_GET_V_LINE (dest, j >> 1);
- guint16 Y0, Y1, U, V;
-
- for (i = 0; i < convert->width - 1; i += 2) {
- Y0 = (src[i * 4 + 1]) >> 6;
- Y1 = (src[i * 4 + 5]) >> 6;
- U = ((src[i * 4 + 2] + src[i * 4 + 6] + 1) >> 1) >> 6;
- V = ((src[i * 4 + 3] + src[i * 4 + 7] + 1) >> 1) >> 6;
-
- GST_WRITE_UINT16_LE (destY + i + 0, Y0);
- GST_WRITE_UINT16_LE (destY + i + 1, Y1);
- GST_WRITE_UINT16_LE (destU + (i >> 1), U);
- GST_WRITE_UINT16_LE (destV + (i >> 1), V);
- }
- if (i == convert->width - 1) {
- Y0 = src[i * 4 + 1] >> 6;
- U = src[i * 4 + 2] >> 6;
- V = src[i * 4 + 3] >> 6;
-
- GST_WRITE_UINT16_LE (destY + i, Y0);
- GST_WRITE_UINT16_LE (destU + (i >> 1), U);
- GST_WRITE_UINT16_LE (destV + (i >> 1), V);
- }
-}
-
-static void
-getline16_I420_10BE (VideoConvert * convert, guint16 * dest,
- const GstVideoFrame * src, int j)
-{
- int i;
- guint16 *srcY = FRAME_GET_Y_LINE (src, j);
- guint16 *srcU = FRAME_GET_U_LINE (src, j >> 1);
- guint16 *srcV = FRAME_GET_V_LINE (src, j >> 1);
-
- for (i = 0; i < convert->width; i++) {
- dest[i * 4 + 0] = 0xffff;
- dest[i * 4 + 1] = GST_READ_UINT16_BE (srcY + i) << 6;
- dest[i * 4 + 2] = GST_READ_UINT16_BE (srcU + (i >> 1)) << 6;
- dest[i * 4 + 3] = GST_READ_UINT16_BE (srcV + (i >> 1)) << 6;
- }
-}
-
-static void
-putline16_I420_10BE (VideoConvert * convert, GstVideoFrame * dest,
- const guint16 * src, int j)
-{
- int i;
- guint16 *destY = FRAME_GET_Y_LINE (dest, j);
- guint16 *destU = FRAME_GET_U_LINE (dest, j >> 1);
- guint16 *destV = FRAME_GET_V_LINE (dest, j >> 1);
- guint16 Y0, Y1, U, V;
-
- for (i = 0; i < convert->width - 1; i += 2) {
- Y0 = src[i * 4 + 1] >> 6;
- Y1 = src[i * 4 + 5] >> 6;
- U = ((src[i * 4 + 2] + src[i * 4 + 6] + 1) >> 1) >> 6;
- V = ((src[i * 4 + 3] + src[i * 4 + 7] + 1) >> 1) >> 6;
-
- GST_WRITE_UINT16_BE (destY + i + 0, Y0);
- GST_WRITE_UINT16_BE (destY + i + 1, Y1);
- GST_WRITE_UINT16_BE (destU + (i >> 1), U);
- GST_WRITE_UINT16_BE (destV + (i >> 1), V);
- }
- if (i == convert->width - 1) {
- Y0 = src[i * 4 + 1] >> 6;
- U = src[i * 4 + 2] >> 6;
- V = src[i * 4 + 3] >> 6;
-
- GST_WRITE_UINT16_BE (destY + i, Y0);
- GST_WRITE_UINT16_BE (destU + (i >> 1), U);
- GST_WRITE_UINT16_BE (destV + (i >> 1), V);
- }
-}
-
-static void
-getline16_convert (VideoConvert * convert, guint16 * dest,
- const GstVideoFrame * src, int j)
-{
- int i;
- convert->getline (convert, convert->tmpline, src, j);
- for (i = 0; i < convert->width * 4; i++) {
- dest[i] = convert->tmpline[i] << 8;
- }
-}
-
-static void
-putline16_convert (VideoConvert * convert, GstVideoFrame * dest,
- const guint16 * src, int j)
-{
- int i;
- for (i = 0; i < convert->width * 4; i++) {
- convert->tmpline[i] = src[i] >> 8;
- }
- convert->putline (convert, dest, convert->tmpline, j);
-}
-
-typedef struct
-{
- GstVideoFormat format;
- void (*getline) (VideoConvert * convert, guint8 * dest,
- const GstVideoFrame * src, int j);
- void (*putline) (VideoConvert * convert, GstVideoFrame * dest,
- const guint8 * src, int j);
- void (*getline16) (VideoConvert * convert, guint16 * dest,
- const GstVideoFrame * src, int j);
- void (*putline16) (VideoConvert * convert, GstVideoFrame * dest,
- const guint16 * src, int j);
-} VideoLine;
-static const VideoLine lines[] = {
- {GST_VIDEO_FORMAT_I420, getline_I420, putline_I420},
- {GST_VIDEO_FORMAT_YV12, getline_YV12, putline_YV12},
- {GST_VIDEO_FORMAT_YUY2, getline_YUY2, putline_YUY2},
- {GST_VIDEO_FORMAT_UYVY, getline_UYVY, putline_UYVY},
- {GST_VIDEO_FORMAT_AYUV, getline_AYUV, putline_AYUV},
- {GST_VIDEO_FORMAT_RGBx, getline_RGBA, putline_RGBA},
- {GST_VIDEO_FORMAT_BGRx, getline_BGRA, putline_BGRA},
- {GST_VIDEO_FORMAT_xRGB, getline_AYUV, putline_AYUV},
- {GST_VIDEO_FORMAT_xBGR, getline_ABGR, putline_ABGR},
- {GST_VIDEO_FORMAT_RGBA, getline_RGBA, putline_RGBA},
- {GST_VIDEO_FORMAT_BGRA, getline_BGRA, putline_BGRA},
- {GST_VIDEO_FORMAT_ARGB, getline_AYUV, putline_AYUV},
- {GST_VIDEO_FORMAT_ABGR, getline_ABGR, putline_ABGR},
- {GST_VIDEO_FORMAT_RGB, getline_RGB, putline_RGB},
- {GST_VIDEO_FORMAT_BGR, getline_BGR, putline_BGR},
- {GST_VIDEO_FORMAT_Y41B, getline_Y41B, putline_Y41B},
- {GST_VIDEO_FORMAT_Y42B, getline_Y42B, putline_Y42B},
- {GST_VIDEO_FORMAT_YVYU, getline_YVYU, putline_YVYU},
- {GST_VIDEO_FORMAT_Y444, getline_Y444, putline_Y444},
- {GST_VIDEO_FORMAT_v210, getline_v210, putline_v210,
- getline16_v210, putline16_v210},
- {GST_VIDEO_FORMAT_v216, getline_v216, putline_v216,
- getline16_v216, putline16_v216},
- {GST_VIDEO_FORMAT_NV12, getline_NV12, putline_NV12},
- {GST_VIDEO_FORMAT_NV21, getline_NV21, putline_NV21},
- {GST_VIDEO_FORMAT_v308, getline_v308, putline_v308},
- {GST_VIDEO_FORMAT_GRAY8, getline_GRAY8, putline_GRAY8},
- {GST_VIDEO_FORMAT_GRAY16_LE, getline_GRAY16_LE, putline_GRAY16_LE},
- //{GST_VIDEO_FORMAT_GRAY16_BE, getline_GRAY16_BE, putline_GRAY16_BE},
- {GST_VIDEO_FORMAT_RGB16, getline_RGB16, putline_RGB16},
- {GST_VIDEO_FORMAT_BGR16, getline_BGR16, putline_BGR16},
- {GST_VIDEO_FORMAT_RGB15, getline_RGB15, putline_RGB15},
- {GST_VIDEO_FORMAT_BGR15, getline_BGR15, putline_BGR15},
- {GST_VIDEO_FORMAT_UYVP, getline_UYVP, putline_UYVP},
- {GST_VIDEO_FORMAT_A420, getline_A420, putline_A420}
- , {GST_VIDEO_FORMAT_RGB8_PALETTED, getline_RGB8P, putline_RGB8P},
- {GST_VIDEO_FORMAT_YUV9, getline_YUV9, putline_YUV9},
- {GST_VIDEO_FORMAT_YVU9, getline_YUV9, putline_YUV9}, /* alias */
- {GST_VIDEO_FORMAT_IYU1, getline_IYU1, putline_IYU1},
- {GST_VIDEO_FORMAT_ARGB64, getline_AY64, putline_AY64, getline16_AY64,
- putline16_AY64},
- {GST_VIDEO_FORMAT_AYUV64, getline_AY64, putline_AY64, getline16_AY64,
- putline16_AY64},
- {GST_VIDEO_FORMAT_r210, getline_r210, putline_r210, getline16_r210,
- putline16_r210},
- {GST_VIDEO_FORMAT_I420_10BE, getline_I420_10BE, putline_I420_10BE,
- getline16_I420_10BE, putline16_I420_10BE},
- {GST_VIDEO_FORMAT_I420_10LE, getline_I420_10LE, putline_I420_10LE,
- getline16_I420_10LE, putline16_I420_10LE}
-};
-
static void
matrix_rgb_to_yuv_bt470_6 (VideoConvert * convert)
{
static void
-videoconvert_convert_lookup_getput (VideoConvert * convert)
+videoconvert_convert_lookup_matrix (VideoConvert * convert)
{
- int i;
-
- convert->getline = NULL;
- convert->getline16 = NULL;
- for (i = 0; i < sizeof (lines) / sizeof (lines[0]); i++) {
- if (lines[i].format == convert->from_format) {
- convert->getline = lines[i].getline;
- convert->getline16 = lines[i].getline16;
- break;
- }
- }
- convert->putline = NULL;
- convert->putline16 = NULL;
- for (i = 0; i < sizeof (lines) / sizeof (lines[0]); i++) {
- if (lines[i].format == convert->to_format) {
- convert->putline = lines[i].putline;
- convert->putline16 = lines[i].putline16;
- break;
- }
- }
- GST_DEBUG ("get %p put %p", convert->getline, convert->putline);
-
- if (convert->getline16 == NULL) {
- convert->getline16 = getline16_convert;
- }
- if (convert->putline16 == NULL) {
- convert->putline16 = putline16_convert;
- }
-
if (convert->from_spec == convert->to_spec) {
GST_DEBUG ("using identity matrix");
convert->matrix = matrix_identity;
GST_DEBUG ("using YUV BT470_6 -> YUV BT709");
convert->matrix = matrix_yuv_bt470_6_to_yuv_bt709;
convert->matrix16 = matrix16_yuv_bt470_6_to_yuv_bt709;
- }
-}
-
-static void
-videoconvert_convert_generic (VideoConvert * convert, GstVideoFrame * dest,
- const GstVideoFrame * src)
-{
- int j;
-
- if (convert->getline == NULL) {
- GST_ERROR ("no getline for format %s",
- gst_video_format_to_string (GST_VIDEO_FRAME_FORMAT (src)));
- return;
- }
-
- if (convert->putline == NULL) {
- GST_ERROR ("no putline for format %s",
- gst_video_format_to_string (GST_VIDEO_FRAME_FORMAT (dest)));
- return;
- }
-
- if (convert->use_16bit) {
- for (j = 0; j < convert->height; j++) {
- convert->getline16 (convert, convert->tmpline16, src, j);
- convert->matrix16 (convert);
- convert->dither16 (convert, j);
- convert->putline16 (convert, dest, convert->tmpline16, j);
- }
} else {
- for (j = 0; j < convert->height; j++) {
- convert->getline (convert, convert->tmpline, src, j);
- convert->matrix (convert);
- convert->putline (convert, dest, convert->tmpline, j);
- }
+ GST_DEBUG ("using identity matrix");
+ convert->matrix = matrix_identity;
+ convert->matrix16 = matrix16_identity;
}
}
}
}
+#define TO_16(x) (((x)<<8) | (x))
+
+#define UNPACK_FRAME(frame,dest,line,width) \
+ frame->info.finfo->unpack_func (frame->info.finfo, GST_VIDEO_PACK_FLAG_NONE, \
+ dest, frame->data, frame->info.stride, 0, line, width)
+#define PACK_FRAME(frame,dest,line,width) \
+ frame->info.finfo->pack_func (frame->info.finfo, GST_VIDEO_PACK_FLAG_NONE, \
+ dest, 0, frame->data, frame->info.stride, frame->info.chroma_site, line, width);
+
+static void
+videoconvert_convert_generic (VideoConvert * convert, GstVideoFrame * dest,
+ const GstVideoFrame * src)
+{
+ int i, j;
+ const GstVideoFormatInfo *sfinfo, *dfinfo;
+ gint width, height;
+ guint src_bits, dest_bits;
+
+ sfinfo = src->info.finfo;
+ dfinfo = dest->info.finfo;
+
+ src_bits =
+ GST_VIDEO_FORMAT_INFO_DEPTH (gst_video_format_get_info
+ (sfinfo->unpack_format), 0);
+ dest_bits =
+ GST_VIDEO_FORMAT_INFO_DEPTH (gst_video_format_get_info
+ (dfinfo->unpack_format), 0);
+
+ height = convert->height;
+ width = convert->width;
+
+ if (sfinfo->unpack_func == NULL) {
+ GST_ERROR ("no unpack_func for format %s",
+ gst_video_format_to_string (GST_VIDEO_FRAME_FORMAT (src)));
+ return;
+ }
+
+ if (dfinfo->pack_func == NULL) {
+ GST_ERROR ("no pack_func for format %s",
+ gst_video_format_to_string (GST_VIDEO_FRAME_FORMAT (dest)));
+ return;
+ }
+
+ for (j = 0; j < height; j++) {
+ if (src_bits == 16) {
+ UNPACK_FRAME (src, convert->tmpline16, j, width);
+ } else {
+ UNPACK_FRAME (src, convert->tmpline, j, width);
+
+ if (dest_bits == 16)
+ for (i = 0; i < width * 4; i++)
+ convert->tmpline16[i] = TO_16 (convert->tmpline[i]);
+ }
+
+ if (dest_bits == 16 || src_bits == 16) {
+ convert->matrix16 (convert);
+ convert->dither16 (convert, j);
+ } else {
+ convert->matrix (convert);
+ }
+
+ if (dest_bits == 16) {
+ PACK_FRAME (dest, convert->tmpline16, j, width);
+ } else {
+ if (src_bits == 16)
+ for (i = 0; i < width * 4; i++)
+ convert->tmpline[i] = convert->tmpline16[i] >> 8;
+
+ PACK_FRAME (dest, convert->tmpline, j, width);
+ }
+ }
+}
+
+#define FRAME_GET_PLANE_STRIDE(frame, plane) \
+ GST_VIDEO_FRAME_PLANE_STRIDE (frame, plane)
+#define FRAME_GET_PLANE_LINE(frame, plane, line) \
+ (gpointer)(((guint8*)(GST_VIDEO_FRAME_PLANE_DATA (frame, plane))) + \
+ FRAME_GET_PLANE_STRIDE (frame, plane) * (line))
+
+#define FRAME_GET_COMP_STRIDE(frame, comp) \
+ GST_VIDEO_FRAME_COMP_STRIDE (frame, comp)
+#define FRAME_GET_COMP_LINE(frame, comp, line) \
+ (gpointer)(((guint8*)(GST_VIDEO_FRAME_COMP_DATA (frame, comp))) + \
+ FRAME_GET_COMP_STRIDE (frame, comp) * (line))
+
+#define FRAME_GET_STRIDE(frame) FRAME_GET_PLANE_STRIDE (frame, 0)
+#define FRAME_GET_LINE(frame,line) FRAME_GET_PLANE_LINE (frame, 0, line)
+
+#define FRAME_GET_Y_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_Y, line)
+#define FRAME_GET_U_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_U, line)
+#define FRAME_GET_V_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_V, line)
+#define FRAME_GET_A_LINE(frame,line) FRAME_GET_COMP_LINE(frame, GST_VIDEO_COMP_A, line)
+
+#define FRAME_GET_Y_STRIDE(frame) FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_Y)
+#define FRAME_GET_U_STRIDE(frame) FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_U)
+#define FRAME_GET_V_STRIDE(frame) FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_V)
+#define FRAME_GET_A_STRIDE(frame) FRAME_GET_COMP_STRIDE(frame, GST_VIDEO_COMP_A)
+
/* Fast paths */
static void
const GstVideoFrame * src)
{
int i;
+ gint width = convert->width;
+ gint height = convert->height;
- for (i = 0; i < GST_ROUND_DOWN_2 (convert->height); i += 2) {
+ for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
cogorc_convert_I420_YUY2 (FRAME_GET_LINE (dest, i),
FRAME_GET_LINE (dest, i + 1),
FRAME_GET_Y_LINE (src, i),
FRAME_GET_Y_LINE (src, i + 1),
FRAME_GET_U_LINE (src, i >> 1),
- FRAME_GET_V_LINE (src, i >> 1), (convert->width + 1) / 2);
+ FRAME_GET_V_LINE (src, i >> 1), (width + 1) / 2);
}
/* now handle last line */
- if (convert->height & 1) {
- getline_I420 (convert, convert->tmpline, src, convert->height - 1);
- putline_YUY2 (convert, dest, convert->tmpline, convert->height - 1);
+ if (height & 1) {
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
const GstVideoFrame * src)
{
int i;
+ gint width = convert->width;
+ gint height = convert->height;
- for (i = 0; i < GST_ROUND_DOWN_2 (convert->height); i += 2) {
+ for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
cogorc_convert_I420_UYVY (FRAME_GET_LINE (dest, i),
FRAME_GET_LINE (dest, i + 1),
FRAME_GET_Y_LINE (src, i),
FRAME_GET_Y_LINE (src, i + 1),
FRAME_GET_U_LINE (src, i >> 1),
- FRAME_GET_V_LINE (src, i >> 1), (convert->width + 1) / 2);
+ FRAME_GET_V_LINE (src, i >> 1), (width + 1) / 2);
}
/* now handle last line */
- if (convert->height & 1) {
- getline_I420 (convert, convert->tmpline, src, convert->height - 1);
- putline_UYVY (convert, dest, convert->tmpline, convert->height - 1);
+ if (height & 1) {
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
const GstVideoFrame * src)
{
int i;
+ gint width = convert->width;
+ gint height = convert->height;
- for (i = 0; i < GST_ROUND_DOWN_2 (convert->height); i += 2) {
+ for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
cogorc_convert_I420_AYUV (FRAME_GET_LINE (dest, i),
FRAME_GET_LINE (dest, i + 1),
FRAME_GET_Y_LINE (src, i),
FRAME_GET_Y_LINE (src, i + 1),
- FRAME_GET_U_LINE (src, i >> 1),
- FRAME_GET_V_LINE (src, i >> 1), convert->width);
+ FRAME_GET_U_LINE (src, i >> 1), FRAME_GET_V_LINE (src, i >> 1), width);
}
/* now handle last line */
- if (convert->height & 1) {
- getline_I420 (convert, convert->tmpline, src, convert->height - 1);
- putline_AYUV (convert, dest, convert->tmpline, convert->height - 1);
+ if (height & 1) {
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
convert_I420_Y42B (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), FRAME_GET_Y_STRIDE (dest),
- FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src),
- convert->width, convert->height);
+ FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src), width, height);
cogorc_planar_chroma_420_422 (FRAME_GET_U_LINE (dest, 0),
2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (dest, 1),
2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
- FRAME_GET_U_STRIDE (src), (convert->width + 1) / 2, convert->height / 2);
+ FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2);
cogorc_planar_chroma_420_422 (FRAME_GET_V_LINE (dest, 0),
2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (dest, 1),
2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
- FRAME_GET_V_STRIDE (src), (convert->width + 1) / 2, convert->height / 2);
+ FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2);
}
static void
convert_I420_Y444 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), FRAME_GET_Y_STRIDE (dest),
- FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src),
- convert->width, convert->height);
+ FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src), width, height);
cogorc_planar_chroma_420_444 (FRAME_GET_U_LINE (dest, 0),
2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (dest, 1),
2 * FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
- FRAME_GET_U_STRIDE (src), (convert->width + 1) / 2, convert->height / 2);
+ FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2);
cogorc_planar_chroma_420_444 (FRAME_GET_V_LINE (dest, 0),
2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (dest, 1),
2 * FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
- FRAME_GET_V_STRIDE (src), (convert->width + 1) / 2, convert->height / 2);
+ FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2);
/* now handle last line */
- if (convert->height & 1) {
- getline_I420 (convert, convert->tmpline, src, convert->height - 1);
- putline_Y444 (convert, dest, convert->tmpline, convert->height - 1);
+ if (height & 1) {
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
const GstVideoFrame * src)
{
int i, h;
+ gint width = convert->width;
+ gint height = convert->height;
- h = convert->height;
- if (convert->width & 1)
+ h = height;
+ if (width & 1)
h--;
for (i = 0; i < h; i += 2) {
FRAME_GET_Y_LINE (dest, i + 1),
FRAME_GET_U_LINE (dest, i >> 1),
FRAME_GET_V_LINE (dest, i >> 1),
- FRAME_GET_LINE (src, i),
- FRAME_GET_LINE (src, i + 1), (convert->width + 1) / 2);
+ FRAME_GET_LINE (src, i), FRAME_GET_LINE (src, i + 1), (width + 1) / 2);
}
/* now handle last line */
- if (convert->height & 1) {
- getline_YUY2 (convert, convert->tmpline, src, convert->height - 1);
- putline_I420 (convert, dest, convert->tmpline, convert->height - 1);
+ if (height & 1) {
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
convert_YUY2_AYUV (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_YUY2_AYUV (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), (convert->width + 1) / 2,
- convert->height & 1 ? convert->height - 1 : convert->height);
+ FRAME_GET_STRIDE (src), (width + 1) / 2,
+ height & 1 ? height - 1 : height);
/* now handle last line */
- if (convert->height & 1) {
- getline_YUY2 (convert, convert->tmpline, src, convert->height - 1);
- putline_AYUV (convert, dest, convert->tmpline, convert->height - 1);
+ if (height & 1) {
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
convert_YUY2_Y42B (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_YUY2_Y42B (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_STRIDE (src), (width + 1) / 2, height);
}
static void
convert_YUY2_Y444 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_YUY2_Y444 (FRAME_GET_COMP_LINE (dest, 0, 0),
FRAME_GET_COMP_STRIDE (dest, 0), FRAME_GET_COMP_LINE (dest, 1, 0),
FRAME_GET_COMP_STRIDE (dest, 1), FRAME_GET_COMP_LINE (dest, 2, 0),
FRAME_GET_COMP_STRIDE (dest, 2), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_STRIDE (src), (width + 1) / 2, height);
}
const GstVideoFrame * src)
{
int i;
+ gint width = convert->width;
+ gint height = convert->height;
- for (i = 0; i < GST_ROUND_DOWN_2 (convert->height); i += 2) {
+ for (i = 0; i < GST_ROUND_DOWN_2 (height); i += 2) {
cogorc_convert_UYVY_I420 (FRAME_GET_COMP_LINE (dest, 0, i),
FRAME_GET_COMP_LINE (dest, 0, i + 1),
FRAME_GET_COMP_LINE (dest, 1, i >> 1),
FRAME_GET_COMP_LINE (dest, 2, i >> 1),
- FRAME_GET_LINE (src, i),
- FRAME_GET_LINE (src, i + 1), (convert->width + 1) / 2);
+ FRAME_GET_LINE (src, i), FRAME_GET_LINE (src, i + 1), (width + 1) / 2);
}
/* now handle last line */
- if (convert->height & 1) {
- getline_UYVY (convert, convert->tmpline, src, convert->height - 1);
- putline_I420 (convert, dest, convert->tmpline, convert->height - 1);
+ if (height & 1) {
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
convert_UYVY_AYUV (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_UYVY_AYUV (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), (convert->width + 1) / 2,
- convert->height & 1 ? convert->height - 1 : convert->height);
+ FRAME_GET_STRIDE (src), (width + 1) / 2,
+ height & 1 ? height - 1 : height);
/* now handle last line */
- if (convert->height & 1) {
- getline_UYVY (convert, convert->tmpline, src, convert->height - 1);
- putline_AYUV (convert, dest, convert->tmpline, convert->height - 1);
+ if (height & 1) {
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
convert_UYVY_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_UYVY_YUY2 (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_STRIDE (src), (width + 1) / 2, height);
}
static void
convert_UYVY_Y42B (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_UYVY_Y42B (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_STRIDE (src), (width + 1) / 2, height);
}
static void
convert_UYVY_Y444 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_UYVY_Y444 (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_STRIDE (src), (width + 1) / 2, height);
}
static void
convert_AYUV_I420 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_AYUV_I420 (FRAME_GET_Y_LINE (dest, 0),
2 * FRAME_GET_Y_STRIDE (dest), FRAME_GET_Y_LINE (dest, 1),
2 * FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
2 * FRAME_GET_STRIDE (src), FRAME_GET_LINE (src, 1),
- 2 * FRAME_GET_STRIDE (src), convert->width / 2, convert->height / 2);
+ 2 * FRAME_GET_STRIDE (src), width / 2, height / 2);
}
static void
convert_AYUV_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_AYUV_YUY2 (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), convert->width / 2, convert->height);
+ FRAME_GET_STRIDE (src), width / 2, height);
}
static void
convert_AYUV_UYVY (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_AYUV_UYVY (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), convert->width / 2, convert->height);
+ FRAME_GET_STRIDE (src), width / 2, height);
}
static void
convert_AYUV_Y42B (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_AYUV_Y42B (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), (convert->width + 1) / 2,
- convert->height & 1 ? convert->height - 1 : convert->height);
+ FRAME_GET_STRIDE (src), (width + 1) / 2,
+ height & 1 ? height - 1 : height);
/* now handle last line */
- if (convert->height & 1) {
- getline_AYUV (convert, convert->tmpline, src, convert->height - 1);
- putline_Y42B (convert, dest, convert->tmpline, convert->height - 1);
+ if (height & 1) {
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
convert_AYUV_Y444 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_AYUV_Y444 (FRAME_GET_Y_LINE (dest, 0),
FRAME_GET_Y_STRIDE (dest), FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), convert->width, convert->height);
+ FRAME_GET_STRIDE (src), width, height);
}
static void
convert_Y42B_I420 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), FRAME_GET_Y_STRIDE (dest),
- FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src),
- convert->width, convert->height);
+ FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src), width, height);
cogorc_planar_chroma_422_420 (FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
2 * FRAME_GET_U_STRIDE (src), FRAME_GET_U_LINE (src, 1),
- 2 * FRAME_GET_U_STRIDE (src), (convert->width + 1) / 2,
- convert->height / 2);
+ 2 * FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2);
cogorc_planar_chroma_422_420 (FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
2 * FRAME_GET_V_STRIDE (src), FRAME_GET_V_LINE (src, 1),
- 2 * FRAME_GET_V_STRIDE (src), (convert->width + 1) / 2,
- convert->height / 2);
+ 2 * FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2);
/* now handle last line */
- if (convert->height & 1) {
- getline_Y42B (convert, convert->tmpline, src, convert->height - 1);
- putline_I420 (convert, dest, convert->tmpline, convert->height - 1);
+ if (height & 1) {
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
convert_Y42B_Y444 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), FRAME_GET_Y_STRIDE (dest),
- FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src),
- convert->width, convert->height);
+ FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src), width, height);
cogorc_planar_chroma_422_444 (FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
- FRAME_GET_U_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_U_STRIDE (src), (width + 1) / 2, height);
cogorc_planar_chroma_422_444 (FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
- FRAME_GET_V_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_V_STRIDE (src), (width + 1) / 2, height);
}
static void
convert_Y42B_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_Y42B_YUY2 (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
- FRAME_GET_V_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_V_STRIDE (src), (width + 1) / 2, height);
}
static void
convert_Y42B_UYVY (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_Y42B_UYVY (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
- FRAME_GET_V_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_V_STRIDE (src), (width + 1) / 2, height);
}
static void
convert_Y42B_AYUV (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_Y42B_AYUV (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
- FRAME_GET_V_STRIDE (src), (convert->width) / 2, convert->height);
+ FRAME_GET_V_STRIDE (src), (width) / 2, height);
}
static void
convert_Y444_I420 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), FRAME_GET_Y_STRIDE (dest),
- FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src),
- convert->width, convert->height);
+ FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src), width, height);
cogorc_planar_chroma_444_420 (FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
2 * FRAME_GET_U_STRIDE (src), FRAME_GET_U_LINE (src, 1),
- 2 * FRAME_GET_U_STRIDE (src), (convert->width + 1) / 2,
- convert->height / 2);
+ 2 * FRAME_GET_U_STRIDE (src), (width + 1) / 2, height / 2);
cogorc_planar_chroma_444_420 (FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
2 * FRAME_GET_V_STRIDE (src), FRAME_GET_V_LINE (src, 1),
- 2 * FRAME_GET_V_STRIDE (src), (convert->width + 1) / 2,
- convert->height / 2);
+ 2 * FRAME_GET_V_STRIDE (src), (width + 1) / 2, height / 2);
/* now handle last line */
- if (convert->height & 1) {
- getline_Y444 (convert, convert->tmpline, src, convert->height - 1);
- putline_I420 (convert, dest, convert->tmpline, convert->height - 1);
+ if (height & 1) {
+ UNPACK_FRAME (src, convert->tmpline, height - 1, width);
+ PACK_FRAME (dest, convert->tmpline, height - 1, width);
}
}
convert_Y444_Y42B (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_memcpy_2d (FRAME_GET_Y_LINE (dest, 0), FRAME_GET_Y_STRIDE (dest),
- FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src),
- convert->width, convert->height);
+ FRAME_GET_Y_LINE (src, 0), FRAME_GET_Y_STRIDE (src), width, height);
cogorc_planar_chroma_444_422 (FRAME_GET_U_LINE (dest, 0),
FRAME_GET_U_STRIDE (dest), FRAME_GET_U_LINE (src, 0),
- FRAME_GET_U_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_U_STRIDE (src), (width + 1) / 2, height);
cogorc_planar_chroma_444_422 (FRAME_GET_V_LINE (dest, 0),
FRAME_GET_V_STRIDE (dest), FRAME_GET_V_LINE (src, 0),
- FRAME_GET_V_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_V_STRIDE (src), (width + 1) / 2, height);
}
static void
convert_Y444_YUY2 (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_Y444_YUY2 (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
- FRAME_GET_V_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_V_STRIDE (src), (width + 1) / 2, height);
}
static void
convert_Y444_UYVY (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_Y444_UYVY (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
- FRAME_GET_V_STRIDE (src), (convert->width + 1) / 2, convert->height);
+ FRAME_GET_V_STRIDE (src), (width + 1) / 2, height);
}
static void
convert_Y444_AYUV (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_Y444_AYUV (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_Y_LINE (src, 0),
FRAME_GET_Y_STRIDE (src), FRAME_GET_U_LINE (src, 0),
FRAME_GET_U_STRIDE (src), FRAME_GET_V_LINE (src, 0),
- FRAME_GET_V_STRIDE (src), convert->width, convert->height);
+ FRAME_GET_V_STRIDE (src), width, height);
}
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
convert_AYUV_ARGB (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_AYUV_ARGB (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), convert->width, convert->height);
+ FRAME_GET_STRIDE (src), width, height);
}
static void
convert_AYUV_BGRA (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_AYUV_BGRA (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), convert->width, convert->height);
+ FRAME_GET_STRIDE (src), width, height);
}
static void
convert_AYUV_ABGR (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_AYUV_ABGR (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), convert->width, convert->height);
+ FRAME_GET_STRIDE (src), width, height);
}
static void
convert_AYUV_RGBA (VideoConvert * convert, GstVideoFrame * dest,
const GstVideoFrame * src)
{
+ gint width = convert->width;
+ gint height = convert->height;
+
cogorc_convert_AYUV_RGBA (FRAME_GET_LINE (dest, 0),
FRAME_GET_STRIDE (dest), FRAME_GET_LINE (src, 0),
- FRAME_GET_STRIDE (src), convert->width, convert->height);
+ FRAME_GET_STRIDE (src), width, height);
}
static void
{
int i;
int quality = 0;
+ gint width = convert->width;
+ gint height = convert->height;
if (quality > 3) {
- for (i = 0; i < convert->height; i++) {
+ for (i = 0; i < height; i++) {
if (i & 1) {
cogorc_convert_I420_BGRA_avg (FRAME_GET_LINE (dest, i),
FRAME_GET_Y_LINE (src, i),
FRAME_GET_U_LINE (src, i >> 1),
FRAME_GET_U_LINE (src, (i >> 1) + 1),
FRAME_GET_V_LINE (src, i >> 1),
- FRAME_GET_V_LINE (src, (i >> 1) + 1), convert->width);
+ FRAME_GET_V_LINE (src, (i >> 1) + 1), width);
} else {
cogorc_convert_I420_BGRA (FRAME_GET_LINE (dest, i),
FRAME_GET_Y_LINE (src, i),
FRAME_GET_U_LINE (src, i >> 1),
- FRAME_GET_V_LINE (src, i >> 1), convert->width);
+ FRAME_GET_V_LINE (src, i >> 1), width);
}
}
} else {
- for (i = 0; i < convert->height; i++) {
+ for (i = 0; i < height; i++) {
cogorc_convert_I420_BGRA (FRAME_GET_LINE (dest, i),
FRAME_GET_Y_LINE (src, i),
FRAME_GET_U_LINE (src, i >> 1),
- FRAME_GET_V_LINE (src, i >> 1), convert->width);
+ FRAME_GET_V_LINE (src, i >> 1), width);
}
}
}