gl: pass large structure by const pointer, not value
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Wed, 9 Apr 2014 09:28:46 +0000 (10:28 +0100)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Wed, 9 Apr 2014 09:31:19 +0000 (10:31 +0100)
Avoids large pointless memcpy.

Coverity 206236, 206237

ext/gl/effects/gstgleffectlumatocurve.c
ext/gl/effects/gstgleffectlumatocurve.h
ext/gl/effects/gstgleffectrgbtocurve.c
ext/gl/effects/gstgleffectxray.c

index df888ef..643e34b 100644 (file)
@@ -26,7 +26,7 @@
 
 void
 gst_gl_effects_luma_to_curve (GstGLEffects * effects,
-    GstGLEffectsCurve curve,
+    const GstGLEffectsCurve * curve,
     gint curve_index, gint width, gint height, GLuint texture)
 {
   GstGLShader *shader;
@@ -65,8 +65,8 @@ gst_gl_effects_luma_to_curve (GstGLEffects * effects,
     gl->TexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);
     gl->TexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP);
 
-    gl->TexImage1D (GL_TEXTURE_1D, 0, curve.bytes_per_pixel,
-        curve.width, 0, GL_RGB, GL_UNSIGNED_BYTE, curve.pixel_data);
+    gl->TexImage1D (GL_TEXTURE_1D, 0, curve->bytes_per_pixel,
+        curve->width, 0, GL_RGB, GL_UNSIGNED_BYTE, curve->pixel_data);
 
     gl->Disable (GL_TEXTURE_1D);
   }
@@ -96,7 +96,7 @@ gst_gl_effects_heat_callback (gint width, gint height, guint texture,
 {
   GstGLEffects *effects = GST_GL_EFFECTS (data);
 
-  gst_gl_effects_luma_to_curve (effects, heat_curve, GST_GL_EFFECTS_CURVE_HEAT,
+  gst_gl_effects_luma_to_curve (effects, &heat_curve, GST_GL_EFFECTS_CURVE_HEAT,
       width, height, texture);
 }
 
@@ -115,7 +115,7 @@ gst_gl_effects_sepia_callback (gint width, gint height, guint texture,
 {
   GstGLEffects *effects = GST_GL_EFFECTS (data);
 
-  gst_gl_effects_luma_to_curve (effects, sepia_curve,
+  gst_gl_effects_luma_to_curve (effects, &sepia_curve,
       GST_GL_EFFECTS_CURVE_SEPIA, width, height, texture);
 }
 
@@ -134,7 +134,7 @@ gst_gl_effects_luma_xpro_callback (gint width, gint height, guint texture,
 {
   GstGLEffects *effects = GST_GL_EFFECTS (data);
 
-  gst_gl_effects_luma_to_curve (effects, luma_xpro_curve,
+  gst_gl_effects_luma_to_curve (effects, &luma_xpro_curve,
       GST_GL_EFFECTS_CURVE_LUMA_XPRO, width, height, texture);
 }
 
index 1260416..509b45b 100644 (file)
@@ -26,7 +26,7 @@
 G_BEGIN_DECLS
 
 void gst_gl_effects_luma_to_curve (GstGLEffects *effects,
-                                   GstGLEffectsCurve curve,
+                                   const GstGLEffectsCurve *curve,
                                    gint curve_index,
                                    gint width, gint height,
                                    GLuint texture);
index cac309f..3e4dda6 100644 (file)
@@ -26,7 +26,7 @@
 
 static void
 gst_gl_effects_rgb_to_curve (GstGLEffects * effects,
-    GstGLEffectsCurve curve,
+    const GstGLEffectsCurve * curve,
     gint curve_index, gint width, gint height, GLuint texture)
 {
   GstGLShader *shader;
@@ -65,8 +65,8 @@ gst_gl_effects_rgb_to_curve (GstGLEffects * effects,
     gl->TexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);
     gl->TexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP);
 
-    gl->TexImage1D (GL_TEXTURE_1D, 0, curve.bytes_per_pixel,
-        curve.width, 0, GL_RGB, GL_UNSIGNED_BYTE, curve.pixel_data);
+    gl->TexImage1D (GL_TEXTURE_1D, 0, curve->bytes_per_pixel,
+        curve->width, 0, GL_RGB, GL_UNSIGNED_BYTE, curve->pixel_data);
 
     gl->Disable (GL_TEXTURE_1D);
   }
@@ -96,7 +96,7 @@ gst_gl_effects_xpro_callback (gint width, gint height, guint texture,
 {
   GstGLEffects *effects = GST_GL_EFFECTS (data);
 
-  gst_gl_effects_rgb_to_curve (effects, xpro_curve, GST_GL_EFFECTS_CURVE_XPRO,
+  gst_gl_effects_rgb_to_curve (effects, &xpro_curve, GST_GL_EFFECTS_CURVE_XPRO,
       width, height, texture);
 }
 
index d610cc8..6657a9b 100644 (file)
@@ -34,7 +34,7 @@ gst_gl_effects_xray_step_one (gint width, gint height, guint texture,
 {
   GstGLEffects *effects = GST_GL_EFFECTS (data);
 
-  gst_gl_effects_luma_to_curve (effects, xray_curve, GST_GL_EFFECTS_CURVE_XRAY,
+  gst_gl_effects_luma_to_curve (effects, &xray_curve, GST_GL_EFFECTS_CURVE_XRAY,
       width, height, texture);
 }