diff --git a/gst-libs/gst/video/video-overlay-composition.c b/gst-libs/gst/video/video-overlay-composition.c index b9553a466a..4f71180a56 100644 --- a/gst-libs/gst/video/video-overlay-composition.c +++ b/gst-libs/gst/video/video-overlay-composition.c @@ -637,7 +637,7 @@ gst_video_overlay_rectangle_is_same_alpha_type (GstVideoOverlayFormatFlags /** - * gst_video_overlay_rectangle_new_argb: + * gst_video_overlay_rectangle_new_raw: * @pixels: (transfer none): a #GstBuffer pointing to the pixel memory * @render_x: the X co-ordinate on the video where the top-left corner of this * overlay rectangle should be rendered to @@ -662,31 +662,28 @@ gst_video_overlay_rectangle_is_same_alpha_type (GstVideoOverlayFormatFlags * gst_video_overlay_rectangle_unref() when no longer needed. */ GstVideoOverlayRectangle * -gst_video_overlay_rectangle_new_argb (GstBuffer * pixels, +gst_video_overlay_rectangle_new_raw (GstBuffer * pixels, gint render_x, gint render_y, guint render_width, guint render_height, GstVideoOverlayFormatFlags flags) { GstVideoOverlayRectangle *rect; - GstVideoFormat format; GstVideoMeta *vmeta; + GstVideoFormat format; guint width, height; g_return_val_if_fail (GST_IS_BUFFER (pixels), NULL); g_return_val_if_fail (render_height > 0 && render_width > 0, NULL); g_return_val_if_fail (gst_video_overlay_rectangle_check_flags (flags), NULL); -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - format = GST_VIDEO_FORMAT_BGRA; -#else - format = GST_VIDEO_FORMAT_ARGB; -#endif - /* buffer must have video meta with some expected settings */ vmeta = gst_buffer_get_video_meta (pixels); g_return_val_if_fail (vmeta, NULL); - g_return_val_if_fail (vmeta->format == format, NULL); + g_return_val_if_fail (vmeta->format == + GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB || + vmeta->format == GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_YUV, NULL); g_return_val_if_fail (vmeta->flags == GST_VIDEO_FRAME_FLAG_NONE, NULL); + format = vmeta->format; width = vmeta->width; height = vmeta->height; @@ -797,21 +794,9 @@ gst_video_overlay_rectangle_set_render_rectangle (GstVideoOverlayRectangle * rectangle->render_height = render_height; } -#if G_BYTE_ORDER == G_LITTLE_ENDIAN -# define ARGB_A 3 -# define ARGB_R 2 -# define ARGB_G 1 -# define ARGB_B 0 -#else -# define ARGB_A 0 -# define ARGB_R 1 -# define ARGB_G 2 -# define ARGB_B 3 -#endif - /* FIXME: orc-ify */ static void -gst_video_overlay_rectangle_premultiply (GstVideoFrame * frame) +gst_video_overlay_rectangle_premultiply_0 (GstVideoFrame * frame) { int i, j; for (j = 0; j < GST_VIDEO_FRAME_HEIGHT (frame); ++j) { @@ -820,18 +805,17 @@ gst_video_overlay_rectangle_premultiply (GstVideoFrame * frame) line = GST_VIDEO_FRAME_PLANE_DATA (frame, 0); line += GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0) * j; for (i = 0; i < GST_VIDEO_FRAME_WIDTH (frame); ++i) { - int a = line[ARGB_A]; - line[ARGB_R] = line[ARGB_R] * a / 255; - line[ARGB_G] = line[ARGB_G] * a / 255; - line[ARGB_B] = line[ARGB_B] * a / 255; + int a = line[0]; + line[1] = line[1] * a / 255; + line[2] = line[2] * a / 255; + line[3] = line[3] * a / 255; line += 4; } } } -/* FIXME: orc-ify */ static void -gst_video_overlay_rectangle_unpremultiply (GstVideoFrame * frame) +gst_video_overlay_rectangle_premultiply_3 (GstVideoFrame * frame) { int i, j; for (j = 0; j < GST_VIDEO_FRAME_HEIGHT (frame); ++j) { @@ -840,24 +824,106 @@ gst_video_overlay_rectangle_unpremultiply (GstVideoFrame * frame) line = GST_VIDEO_FRAME_PLANE_DATA (frame, 0); line += GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0) * j; for (i = 0; i < GST_VIDEO_FRAME_WIDTH (frame); ++i) { - int a = line[ARGB_A]; + int a = line[3]; + line[0] = line[0] * a / 255; + line[1] = line[1] * a / 255; + line[2] = line[2] * a / 255; + line += 4; + } + } +} + +static void +gst_video_overlay_rectangle_premultiply (GstVideoFrame * frame) +{ + gint alpha_offset; + + alpha_offset = GST_VIDEO_FRAME_COMP_POFFSET (frame, 3); + switch (alpha_offset) { + case 0: + gst_video_overlay_rectangle_premultiply_0 (frame); + break; + case 3: + gst_video_overlay_rectangle_premultiply_3 (frame); + break; + default: + g_assert_not_reached (); + break; + } +} + +/* FIXME: orc-ify */ +static void +gst_video_overlay_rectangle_unpremultiply_0 (GstVideoFrame * frame) +{ + int i, j; + for (j = 0; j < GST_VIDEO_FRAME_HEIGHT (frame); ++j) { + guint8 *line; + + line = GST_VIDEO_FRAME_PLANE_DATA (frame, 0); + line += GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0) * j; + for (i = 0; i < GST_VIDEO_FRAME_WIDTH (frame); ++i) { + int a = line[0]; if (a) { - line[ARGB_R] = MIN ((line[ARGB_R] * 255 + a / 2) / a, 255); - line[ARGB_G] = MIN ((line[ARGB_G] * 255 + a / 2) / a, 255); - line[ARGB_B] = MIN ((line[ARGB_B] * 255 + a / 2) / a, 255); + line[1] = MIN ((line[1] * 255 + a / 2) / a, 255); + line[2] = MIN ((line[2] * 255 + a / 2) / a, 255); + line[3] = MIN ((line[3] * 255 + a / 2) / a, 255); } line += 4; } } } +static void +gst_video_overlay_rectangle_unpremultiply_3 (GstVideoFrame * frame) +{ + int i, j; + for (j = 0; j < GST_VIDEO_FRAME_HEIGHT (frame); ++j) { + guint8 *line; + + line = GST_VIDEO_FRAME_PLANE_DATA (frame, 0); + line += GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0) * j; + for (i = 0; i < GST_VIDEO_FRAME_WIDTH (frame); ++i) { + int a = line[3]; + if (a) { + line[0] = MIN ((line[0] * 255 + a / 2) / a, 255); + line[1] = MIN ((line[1] * 255 + a / 2) / a, 255); + line[2] = MIN ((line[2] * 255 + a / 2) / a, 255); + } + line += 4; + } + } +} + +static void +gst_video_overlay_rectangle_unpremultiply (GstVideoFrame * frame) +{ + gint alpha_offset; + + alpha_offset = GST_VIDEO_FRAME_COMP_POFFSET (frame, 3); + switch (alpha_offset) { + case 0: + gst_video_overlay_rectangle_unpremultiply_0 (frame); + break; + case 3: + gst_video_overlay_rectangle_unpremultiply_3 (frame); + break; + default: + g_assert_not_reached (); + break; + } +} + static void gst_video_overlay_rectangle_extract_alpha (GstVideoOverlayRectangle * rect) { guint8 *src, *dst; GstVideoFrame frame; - gint i, j, w, h, stride; + gint i, j, w, h, stride, alpha_offset; + + alpha_offset = GST_VIDEO_INFO_COMP_POFFSET (&rect->info, 3); + g_return_if_fail (alpha_offset == 0 || alpha_offset == 3); gst_video_frame_map (&frame, &rect->info, rect->pixels, GST_MAP_READ); src = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0); @@ -871,7 +937,7 @@ gst_video_overlay_rectangle_extract_alpha (GstVideoOverlayRectangle * rect) for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { - *dst = src[ARGB_A]; + *dst = src[alpha_offset]; dst++; src += 4; } @@ -888,6 +954,7 @@ gst_video_overlay_rectangle_apply_global_alpha (GstVideoOverlayRectangle * rect, guint8 *src, *dst; GstVideoFrame frame; gint i, j, w, h, stride; + gint argb_a, argb_r, argb_g, argb_b; g_assert (!(rect->applied_global_alpha != 1.0 && rect->initial_alpha == NULL)); @@ -907,22 +974,27 @@ gst_video_overlay_rectangle_apply_global_alpha (GstVideoOverlayRectangle * rect, h = GST_VIDEO_INFO_HEIGHT (&rect->info); stride = GST_VIDEO_INFO_PLANE_STRIDE (&rect->info, 0); + argb_a = GST_VIDEO_INFO_COMP_POFFSET (&rect->info, 3); + argb_r = (argb_a + 1) % 4; + argb_g = (argb_a + 2) % 4; + argb_b = (argb_a + 3) % 4; + for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { guint8 na = (guint8) (*src * global_alpha); if (! !(rect->flags & GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA)) { - dst[ARGB_R] = - (guint8) ((double) (dst[ARGB_R] * 255) / (double) dst[ARGB_A]) * + dst[argb_r] = + (guint8) ((double) (dst[argb_r] * 255) / (double) dst[argb_a]) * na / 255; - dst[ARGB_G] = - (guint8) ((double) (dst[ARGB_G] * 255) / (double) dst[ARGB_A]) * + dst[argb_g] = + (guint8) ((double) (dst[argb_g] * 255) / (double) dst[argb_a]) * na / 255; - dst[ARGB_B] = - (guint8) ((double) (dst[ARGB_B] * 255) / (double) dst[ARGB_A]) * + dst[argb_b] = + (guint8) ((double) (dst[argb_b] * 255) / (double) dst[argb_a]) * na / 255; } - dst[ARGB_A] = na; + dst[argb_a] = na; src++; dst += 4; } @@ -934,7 +1006,7 @@ gst_video_overlay_rectangle_apply_global_alpha (GstVideoOverlayRectangle * rect, } static GstBuffer * -gst_video_overlay_rectangle_get_pixels_argb_internal (GstVideoOverlayRectangle * +gst_video_overlay_rectangle_get_pixels_raw_internal (GstVideoOverlayRectangle * rectangle, GstVideoOverlayFormatFlags flags, gboolean unscaled) { GstVideoOverlayFormatFlags new_flags; @@ -1030,7 +1102,7 @@ gst_video_overlay_rectangle_get_pixels_argb_internal (GstVideoOverlayRectangle * } gst_video_frame_unmap (&frame); - scaled_rect = gst_video_overlay_rectangle_new_argb (buf, + scaled_rect = gst_video_overlay_rectangle_new_raw (buf, 0, 0, wanted_width, wanted_height, new_flags); if (rectangle->global_alpha != 1.0) gst_video_overlay_rectangle_set_global_alpha (scaled_rect, @@ -1061,7 +1133,7 @@ done: /** - * gst_video_overlay_rectangle_get_pixels_argb: + * gst_video_overlay_rectangle_get_pixels_raw: * @rectangle: a #GstVideoOverlayRectangle * @flags: flags * If a global_alpha value != 1 is set for the rectangle, the caller @@ -1076,15 +1148,15 @@ done: * with gst_buffer_ref() if needed. */ GstBuffer * -gst_video_overlay_rectangle_get_pixels_argb (GstVideoOverlayRectangle * +gst_video_overlay_rectangle_get_pixels_raw (GstVideoOverlayRectangle * rectangle, GstVideoOverlayFormatFlags flags) { - return gst_video_overlay_rectangle_get_pixels_argb_internal (rectangle, + return gst_video_overlay_rectangle_get_pixels_raw_internal (rectangle, flags, FALSE); } /** - * gst_video_overlay_rectangle_get_pixels_unscaled_argb: + * gst_video_overlay_rectangle_get_pixels_unscaled_raw: * @rectangle: a #GstVideoOverlayRectangle * @flags: flags. * If a global_alpha value != 1 is set for the rectangle, the caller @@ -1102,12 +1174,12 @@ gst_video_overlay_rectangle_get_pixels_argb (GstVideoOverlayRectangle * * should obtain a reference of her own with gst_buffer_ref() if needed. */ GstBuffer * -gst_video_overlay_rectangle_get_pixels_unscaled_argb (GstVideoOverlayRectangle * +gst_video_overlay_rectangle_get_pixels_unscaled_raw (GstVideoOverlayRectangle * rectangle, GstVideoOverlayFormatFlags flags) { g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), NULL); - return gst_video_overlay_rectangle_get_pixels_argb_internal (rectangle, + return gst_video_overlay_rectangle_get_pixels_raw_internal (rectangle, flags, TRUE); } @@ -1202,7 +1274,7 @@ gst_video_overlay_rectangle_copy (GstVideoOverlayRectangle * rectangle) g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), NULL); - copy = gst_video_overlay_rectangle_new_argb (rectangle->pixels, + copy = gst_video_overlay_rectangle_new_raw (rectangle->pixels, rectangle->x, rectangle->y, rectangle->render_width, rectangle->render_height, rectangle->flags); if (rectangle->global_alpha != 1) diff --git a/gst-libs/gst/video/video-overlay-composition.h b/gst-libs/gst/video/video-overlay-composition.h index 3d38f97c96..16176970bd 100644 --- a/gst-libs/gst/video/video-overlay-composition.h +++ b/gst-libs/gst/video/video-overlay-composition.h @@ -112,9 +112,16 @@ typedef enum { #define GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB GST_VIDEO_FORMAT_ARGB #endif +/** + * GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_YUV: + * + * Supported YUV overlay video format. + */ +#define GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_YUV GST_VIDEO_FORMAT_AYUV + GType gst_video_overlay_rectangle_get_type (void); -GstVideoOverlayRectangle * gst_video_overlay_rectangle_new_argb (GstBuffer * pixels, +GstVideoOverlayRectangle * gst_video_overlay_rectangle_new_raw (GstBuffer * pixels, gint render_x, gint render_y, guint render_width, guint render_height, GstVideoOverlayFormatFlags flags); @@ -135,10 +142,10 @@ gboolean gst_video_overlay_rectangle_get_render_rectangle guint * render_width, guint * render_height); -GstBuffer * gst_video_overlay_rectangle_get_pixels_argb (GstVideoOverlayRectangle * rectangle, +GstBuffer * gst_video_overlay_rectangle_get_pixels_raw (GstVideoOverlayRectangle * rectangle, GstVideoOverlayFormatFlags flags); -GstBuffer * gst_video_overlay_rectangle_get_pixels_unscaled_argb (GstVideoOverlayRectangle * rectangle, +GstBuffer * gst_video_overlay_rectangle_get_pixels_unscaled_raw (GstVideoOverlayRectangle * rectangle, GstVideoOverlayFormatFlags flags); GstVideoOverlayFormatFlags gst_video_overlay_rectangle_get_flags (GstVideoOverlayRectangle * rectangle); diff --git a/tests/check/libs/video.c b/tests/check/libs/video.c index 8407c16bb3..820b032cca 100644 --- a/tests/check/libs/video.c +++ b/tests/check/libs/video.c @@ -883,7 +883,7 @@ GST_START_TEST (test_overlay_composition) gst_buffer_add_video_meta (pix1, GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, 200, 50); - rect1 = gst_video_overlay_rectangle_new_argb (pix1, + rect1 = gst_video_overlay_rectangle_new_raw (pix1, 600, 50, 300, 50, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); gst_buffer_unref (pix1); @@ -943,7 +943,7 @@ GST_START_TEST (test_overlay_composition) fail_unless_equals_int (h, 51); /* get scaled pixbuf and touch last byte */ - pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix1 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); stride = 4 * w; fail_unless (gst_buffer_get_size (pix1) > ((h - 1) * stride + (w * 4) - 1), @@ -959,7 +959,7 @@ GST_START_TEST (test_overlay_composition) fail_unless_equals_int (h, 50); /* get scaled pixbuf and touch last byte */ - pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect2, + pix2 = gst_video_overlay_rectangle_get_pixels_raw (rect2, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); stride = 4 * w; fail_unless (gst_buffer_get_size (pix2) > ((h - 1) * stride + (w * 4) - 1), @@ -969,14 +969,14 @@ GST_START_TEST (test_overlay_composition) fail_unless_equals_int (val, 0); /* get scaled pixbuf again, should be the same buffer as before (caching) */ - pix1 = gst_video_overlay_rectangle_get_pixels_argb (rect2, + pix1 = gst_video_overlay_rectangle_get_pixels_raw (rect2, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); fail_unless (pix1 == pix2); /* now compare the original unscaled ones */ - pix1 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix1 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); - pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect2, + pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect2, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); vmeta = gst_buffer_get_video_meta (pix2); @@ -1047,27 +1047,27 @@ GST_START_TEST (test_overlay_composition_premultiplied_alpha) gst_buffer_add_video_meta (pix1, GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, 200, 50); - rect1 = gst_video_overlay_rectangle_new_argb (pix1, + rect1 = gst_video_overlay_rectangle_new_raw (pix1, 600, 50, 300, 50, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); gst_buffer_unref (pix1); /* same flags, unscaled, should be the same buffer */ - pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); fail_unless (pix1 == pix2); /* same flags, but scaled */ - pix3 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix3 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); fail_if (pix3 == pix1 || pix3 == pix2); /* same again, should hopefully get the same (cached) buffer as before */ - pix4 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix4 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); fail_unless (pix4 == pix3); /* just to update the vars */ - pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); vmeta = gst_buffer_get_video_meta (pix2); @@ -1076,7 +1076,7 @@ GST_START_TEST (test_overlay_composition_premultiplied_alpha) h = vmeta->height; /* now, let's try to get premultiplied alpha from the unpremultiplied input */ - pix5 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix5 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA); fail_if (pix5 == pix1 || pix5 == pix2 || pix5 == pix3); vmeta = gst_buffer_get_video_meta (pix5); @@ -1108,17 +1108,17 @@ GST_START_TEST (test_overlay_composition_premultiplied_alpha) /* same again, now we should be getting back the same buffer as before, * as it should have been cached */ - pix6 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix6 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA); fail_unless (pix6 == pix5); /* just to update the stride var */ - pix3 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix3 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); fail_unless (pix3 == pix4); /* now try to get scaled premultiplied alpha from unpremultiplied input */ - pix7 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix7 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA); fail_if (pix7 == pix1 || pix7 == pix2 || pix7 == pix3 || pix7 == pix5); @@ -1142,15 +1142,15 @@ GST_START_TEST (test_overlay_composition_premultiplied_alpha) gst_buffer_unmap (pix7, &map); /* and the same again, it should be cached now */ - pix8 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix8 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA); fail_unless (pix8 == pix7); /* make sure other cached stuff is still there */ - pix9 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix9 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); fail_unless (pix9 == pix3); - pix10 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix10 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA); fail_unless (pix10 == pix5); @@ -1176,12 +1176,12 @@ GST_START_TEST (test_overlay_composition_global_alpha) gst_buffer_add_video_meta (pix1, GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_OVERLAY_COMPOSITION_FORMAT_RGB, 200, 50); - rect1 = gst_video_overlay_rectangle_new_argb (pix1, + rect1 = gst_video_overlay_rectangle_new_raw (pix1, 600, 50, 300, 50, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); gst_buffer_unref (pix1); /* same flags, unscaled, should be the same buffer */ - pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); fail_unless (pix1 == pix2); @@ -1191,12 +1191,12 @@ GST_START_TEST (test_overlay_composition_global_alpha) h = vmeta->height; /* same flags, but scaled */ - pix3 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix3 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); fail_if (pix3 == pix1 || pix3 == pix2); /* get unscaled premultiplied data, new cached rectangle should be created */ - pix4 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix4 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA); fail_if (pix4 == pix2 || pix4 == pix3); vmeta = gst_buffer_get_video_meta (pix4); @@ -1227,7 +1227,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) gst_buffer_unmap (pix4, &map); /* now premultiplied and scaled, again a new cached rectangle should be cached */ - pix5 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix5 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA); fail_if (pix5 == pix2 || pix5 == pix3 || pix5 == pix4); /* stride and size should be equal to the first scaled rect */ @@ -1272,7 +1272,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) fail_unless_equals_int (flags1, GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA); /* request unscaled pixel-data, global-alpha not applied */ - pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA); /* this should just return the same buffer */ fail_unless (pix2 == pix1); @@ -1295,7 +1295,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) gst_buffer_unmap (pix2, &map); /* unscaled pixel-data, global-alpha applied */ - pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); /* this should be the same buffer with on-the-fly modified alpha-channel */ fail_unless (pix2 == pix1); @@ -1322,7 +1322,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) ga2 = gst_video_overlay_rectangle_get_global_alpha (rect1); fail_unless_equals_float (ga2, 0.25); /* and again request unscaled pixel-data, global-alpha applied */ - pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); fail_unless (pix2 == pix1); /* make sure we got the initial data with adjusted alpha-channel */ @@ -1345,7 +1345,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) /* again: unscaled pixel-data, global-alpha not applied, * this should revert alpha-channel to initial values */ - pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA); fail_unless (pix2 == pix1); /* make sure we got the initial data (input=0x80808080) */ @@ -1367,7 +1367,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) gst_buffer_unmap (pix2, &map); /* now scaled, global-alpha not applied */ - pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA); /* this should just return the rect/buffer, that was cached for these * scaling dimensions */ @@ -1391,7 +1391,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) gst_buffer_unmap (pix2, &map); /* scaled, global-alpha (0.25) applied */ - pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); /* this should just return the rect/buffer, that was cached for these * scaling dimensions with modified alpha channel */ @@ -1416,7 +1416,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) /* now unscaled premultiplied data, global-alpha not applied, * is this really a valid use case?*/ - pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA | GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA); /* this should just return the rect/buffer, that was cached for the @@ -1441,7 +1441,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) gst_buffer_unmap (pix2, &map); /* unscaled premultiplied data, global-alpha (0.25) applied */ - pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA); /* this should just return the rect/buffer, that was cached for the * premultiplied data */ @@ -1472,7 +1472,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) gst_video_overlay_rectangle_set_global_alpha (rect1, 0.75); /* and verify that also premultiplied data is adjusted * correspondingly (though with increasing rounding errors) */ - pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA); /* this should just return the rect/buffer, that was cached for the * premultiplied data */ @@ -1500,7 +1500,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) /* now scaled and premultiplied data, global-alpha not applied, * is this really a valid use case?*/ - pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA | GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA); /* this should just return the rect/buffer, that was cached for the @@ -1525,7 +1525,7 @@ GST_START_TEST (test_overlay_composition_global_alpha) gst_buffer_unmap (pix2, &map); /* scaled and premultiplied data, global-alpha applied */ - pix2 = gst_video_overlay_rectangle_get_pixels_argb (rect1, + pix2 = gst_video_overlay_rectangle_get_pixels_raw (rect1, GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA); /* this should just return the rect/buffer, that was cached for the * first premultiplied+scaled rect*/