GNOME Bugzilla – Bug 710810
geometrictransform: Add a plugin for a 2D perspective transform
Last modified: 2013-12-02 09:29:10 UTC
Created attachment 258024 [details] [review] add a matrix plugin for a 2D perspective transform Hi, in the attached patch I am proposing a "matrix" plugin which applies a 2D perspective (also called projective) transform to the frame buffer. A perspective transform can be used for instance to perform keystone correction when playing the content with a video projector. It is a little and nice generic plugin, but it is my first one, so I could use some review, in particular I am concerned about the gst_matrix_get_property() implementation, I am using a new allocated GValueArray (allocated in get_array_from_matrix()), is that OK? A test program for the plugin can be found here: http://git.ao2.it/experiments/gstreamer.git/tree/HEAD:/c/gst-matrix-example The plugin is based on the "rotate" one, the "semantic diff" can be seen with this script: #!/bin/bash set -e filter() { cat $1 | sed -e 's/ROTATE/MATRIX/g' -e 's/Rotate/Matrix/g' -e 's/rotate/matrix/g' } diff -pu <(filter gstrotate.h) gstmatrix.h | cat diff -pu <(filter gstrotate.c) gstmatrix.c
Review of attachment 258024 [details] [review]: Looks good in general, but the name seems wrong ::: gst/geometrictransform/gstmatrix.c @@ +187,3 @@ + /* Perspective division */ + xi = xp / w; + yi = yp / w; As this is not a normal matrix multiplication but perspective transformation, maybe the element should be called perspectivetransform instead?
Created attachment 258799 [details] [review] geometrictransform: add a 2D perspective transform plugin Hi Sebastian, an affine transform can be seen as a particular case of perspective transform that's why I was calling the plugin just "matrix", but I agree with you that "perspective" is a better name; I am leaving out the "transform" suffix from the plugin name as the plugin is a geometrictransform already. Version 2 attached. Changes since v1: - Rename the element from "matrix" to "perspective" - Rename the "m" property to "matrix" - Don't include math.h and geometricmath.h in gstperspective.c I still have a doubt about gst_perspective_get_property() where I am returning an array allocated in get_array_from_matrix(): whose responsibility is to free that memory? The example program has been updated too: http://git.ao2.it/experiments/gstreamer.git/tree/HEAD:/c/gst-perspective-example Thanks, Antonio P.S. here's the updated "semantic diff" script: #!/bin/bash set -e filter() { cat $1 | sed -e 's/ROTATE/PERSPECTIVE/g' \ -e 's/Rotate/Perspective/g' \ -e 's/rotate/perspective/g' } diff -pu <(filter gstrotate.h) gstperspective.h | cat diff -pu <(filter gstrotate.c) gstperspective.c
ping
commit 8de96a2fbbb1e56dae298887a3a71e6c4572f148 Author: Antonio Ospite <ospite@studenti.unina.it> Date: Sun Oct 20 22:04:38 2013 +0200 geometrictransform: Add a 2D perspective transform plugin The perspective plugin applies a 2D perspective (also called projective) transform to the frame buffer. A perspective transform can be used for instance to perform keystone correction when playing the content with a video projector. https://bugzilla.gnome.org/show_bug.cgi?id=710810