vl/compositor: convert RGB buffer to YUV with color conversion
[mesa.git] / src / gallium / auxiliary / vl / vl_compositor.h
index 2a1f66cfb163fd91752227ee9222263fd6a05b8c..88191762609cbf3e32f9582f00751bd36b644a2d 100644 (file)
@@ -18,7 +18,7 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -29,7 +29,7 @@
 #define vl_compositor_h
 
 #include "pipe/p_state.h"
-#include "pipe/p_video_decoder.h"
+#include "pipe/p_video_codec.h"
 #include "pipe/p_video_state.h"
 
 #include "util/u_rect.h"
@@ -53,6 +53,15 @@ enum vl_compositor_deinterlace
    VL_COMPOSITOR_BOB_BOTTOM
 };
 
+/* clockwise degree */
+enum vl_compositor_rotation
+{
+   VL_COMPOSITOR_ROTATE_0,
+   VL_COMPOSITOR_ROTATE_90,
+   VL_COMPOSITOR_ROTATE_180,
+   VL_COMPOSITOR_ROTATE_270
+};
+
 struct vl_compositor_layer
 {
    bool clearing;
@@ -70,6 +79,7 @@ struct vl_compositor_layer
    } src, dst;
    struct vertex2f zw;
    struct vertex4f colors[4];
+   enum vl_compositor_rotation rotate;
 };
 
 struct vl_compositor_state
@@ -102,13 +112,29 @@ struct vl_compositor
 
    void *vs;
    void *fs_video_buffer;
-   void *fs_weave;
+   void *fs_weave_rgb;
    void *fs_rgba;
 
+   struct {
+      struct {
+         void *y;
+         void *uv;
+      } weave;
+      struct {
+         void *y;
+         void *uv;
+      } bob;
+   } fs_yuv;
+
    struct {
       void *rgb;
       void *yuv;
    } fs_palette;
+
+   struct {
+      void *y;
+      void *uv;
+   } fs_rgb_yuv;
 };
 
 /**
@@ -126,8 +152,10 @@ vl_compositor_init_state(struct vl_compositor_state *state, struct pipe_context
 /**
  * set yuv -> rgba conversion matrix
  */
-void
-vl_compositor_set_csc_matrix(struct vl_compositor_state *settings, const vl_csc_matrix *matrix);
+bool
+vl_compositor_set_csc_matrix(struct vl_compositor_state *settings,
+                             const vl_csc_matrix *matrix,
+                             float luma_min, float luma_max);
 
 /**
  * reset dirty area, so it's cleared with the clear colour
@@ -215,6 +243,38 @@ vl_compositor_set_rgba_layer(struct vl_compositor_state *state,
                              struct u_rect *dst_rect,
                              struct vertex4f *colors);
 
+/**
+ * set the layer rotation
+ */
+void
+vl_compositor_set_layer_rotation(struct vl_compositor_state *state,
+                                 unsigned layer,
+                                 enum vl_compositor_rotation rotate);
+
+/**
+ * deinterlace yuv buffer with full abilities
+ */
+void
+vl_compositor_yuv_deint_full(struct vl_compositor_state *state,
+                             struct vl_compositor *compositor,
+                             struct pipe_video_buffer *src,
+                             struct pipe_video_buffer *dst,
+                             struct u_rect *src_rect,
+                             struct u_rect *dst_rect,
+                             enum vl_compositor_deinterlace deinterlace);
+
+/**
++ * convert rgb to yuv
++ */
+void
+vl_compositor_convert_rgb_to_yuv(struct vl_compositor_state *state,
+                                 struct vl_compositor *compositor,
+                                 unsigned layer,
+                                 struct pipe_resource *src_res,
+                                 struct pipe_video_buffer *dst,
+                                 struct u_rect *src_rect,
+                                 struct u_rect *dst_rect);
+
 /*@}*/
 
 /**