Dave,

I've had to put this code in several different apps now so it feels like it
wants to be in schro.

Have a look and fix up to your liking.

Cheers,
Jonathan.

diff --git a/schroedinger/schroframe.c b/schroedinger/schroframe.c
index f1da003..297dc68 100644
--- a/schroedinger/schroframe.c
+++ b/schroedinger/schroframe.c
@@ -185,7 +185,7 @@ schro_frame_new_from_data_YUY2 (void *data, int width, int
height)
 }
 
 /**
- * schro_frame_new_from_data_YUY2:
+ * schro_frame_new_from_data_UYVY:
  *
  * Creates a new SchroFrame object with the requested size using
  * the data pointed to by @data.  The data must be in UYVY format.
@@ -218,7 +218,7 @@ schro_frame_new_from_data_UYVY (void *data, int width, int
height)
 }
 
 /**
- * schro_frame_new_from_data_YUY2:
+ * schro_frame_new_from_data_UYUV_full:
  *
  * Creates a new SchroFrame object with the requested size using
  * the data pointed to by @data.  The data must be in UYVY format,
@@ -341,6 +341,109 @@ schro_frame_new_from_data_I420 (void *data, int width, int
height)
 }
 
 /**
+ * schro_frame_new_from_data_u8_planar422:
+ *
+ * Creates a new SchroFrame object with the requested size using
+ * the data pointed to by @data.  The data must be in planar 422 YUV format.
+ * The data must remain for the lifetime of the SchroFrame object.
+ * It is recommended to use schro_frame_set_free_callback() for
+ * notification when the data is no longer needed.
+ *
+ * Returns: a new SchroFrame object
+ */
+SchroFrame *
+schro_frame_new_from_data_u8_planar422 (void *data, int width, int height)
+{
+  SchroFrame *frame = schro_frame_new();
+
+  frame->format = SCHRO_FRAME_FORMAT_U8_422;
+
+  frame->width = width;
+  frame->height = height;
+
+  frame->components[0].width = width;
+  frame->components[0].height = height;
+  frame->components[0].stride = ROUND_UP_POW2(width,2);
+  frame->components[0].data = data;
+  frame->components[0].length = frame->components[0].stride *
+    ROUND_UP_POW2(frame->components[0].height,1);
+  frame->components[0].v_shift = 0;
+  frame->components[0].h_shift = 0;
+
+  frame->components[1].width = ROUND_UP_SHIFT(width,1);
+  frame->components[1].height = height;
+  frame->components[1].stride = ROUND_UP_POW2(frame->components[1].width,2);
+  frame->components[1].length =
+    frame->components[1].stride * frame->components[1].height;
+  frame->components[1].data = data + frame->components[0].length;
+  frame->components[1].v_shift = 0;
+  frame->components[1].h_shift = 1;
+
+  frame->components[2].width = ROUND_UP_SHIFT(width,1);
+  frame->components[2].height = height;
+  frame->components[2].stride = ROUND_UP_POW2(frame->components[2].width,2);
+  frame->components[2].length =
+    frame->components[2].stride * frame->components[2].height;
+  frame->components[2].data = data + frame->components[0].length +
frame->components[1].length;
+  frame->components[2].v_shift = 0;
+  frame->components[2].h_shift = 1;
+
+  return frame;
+}
+
+/**
+ * schro_frame_new_from_data_u8_planar444:
+ *
+ * Creates a new SchroFrame object with the requested size using
+ * the data pointed to by @data.  The data must be in planar 444 YUV format.
+ * The data must remain for the lifetime of the SchroFrame object.
+ * It is recommended to use schro_frame_set_free_callback() for
+ * notification when the data is no longer needed.
+ *
+ * Returns: a new SchroFrame object
+ */
+SchroFrame *
+schro_frame_new_from_data_u8_planar444 (void *data, int width, int height)
+{
+  SchroFrame *frame = schro_frame_new();
+
+  frame->format = SCHRO_FRAME_FORMAT_U8_444;
+
+  frame->width = width;
+  frame->height = height;
+
+  frame->components[0].width = width;
+  frame->components[0].height = height;
+  frame->components[0].stride = ROUND_UP_POW2(width,2);
+  frame->components[0].data = data;
+  frame->components[0].length = frame->components[0].stride *
+    ROUND_UP_POW2(frame->components[0].height,1);
+  frame->components[0].v_shift = 0;
+  frame->components[0].h_shift = 0;
+
+  frame->components[1].width = width;
+  frame->components[1].height = height;
+  frame->components[1].stride = ROUND_UP_POW2(frame->components[1].width,2);
+  frame->components[1].length =
+    frame->components[1].stride * frame->components[1].height;
+  frame->components[1].data = data + frame->components[0].length;
+  frame->components[1].v_shift = 0;
+  frame->components[1].h_shift = 0;
+
+  frame->components[2].width = width;
+  frame->components[2].height = height;
+  frame->components[2].stride = ROUND_UP_POW2(frame->components[2].width,2);
+  frame->components[2].length =
+    frame->components[2].stride * frame->components[2].height;
+  frame->components[2].data = data + frame->components[0].length +
frame->components[1].length;
+  frame->components[2].v_shift = 0;
+  frame->components[2].h_shift = 0;
+
+  return frame;
+}
+
+
+/**
  * schro_frame_new_from_data_YV12:
  *
  * Creates a new SchroFrame object with the requested size using


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Schrodinger-devel mailing list
Schrodinger-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/schrodinger-devel

Reply via email to