After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 764801 - pipeline: Place gegl:crop before photos:magic-filter, and rethink some implementation details
pipeline: Place gegl:crop before photos:magic-filter, and rethink some implem...
Status: RESOLVED FIXED
Product: gnome-photos
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME photos maintainer(s)
GNOME photos maintainer(s)
Depends on: 764795 764797
Blocks: 763156
 
 
Reported: 2016-04-08 18:37 UTC by Debarshi Ray
Modified: 2016-09-09 12:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
pipeline: Mark nodes as passthrough instead of actually removing them (4.38 KB, patch)
2016-04-08 18:41 UTC, Debarshi Ray
committed Details | Review
pipeline: Refactor connecting a list of nodes into a separate function (2.59 KB, patch)
2016-04-08 18:41 UTC, Debarshi Ray
committed Details | Review
pipeline: Refactor photos_pipeline_reset to be more extensible (2.27 KB, patch)
2016-04-08 18:42 UTC, Debarshi Ray
committed Details | Review
pipeline: Assign a fixed position to gegl:crop (977 bytes, patch)
2016-04-08 18:42 UTC, Debarshi Ray
committed Details | Review
pipeline: Refactor connecting a list of nodes into a separate function (2.92 KB, patch)
2016-09-09 12:31 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2016-04-08 18:37:00 UTC
Currently if you select a magic filter with a vignette followed by crop, then the vignette will get clipped. This is not good because if the magic filter added a vignette then the crop should not interfere with it. If the user doesn't want a vignette, then she can either use a different magic-filter preset or just mix and match the other tools.

Secondly, we should move towards having fixed positions for all the operations. That is what prominent non-destructive editors do. eg., Darktable [1] and Shotwell [2]. We won't be able to change the order for images edited in previous versions because it is already baked in the XML, and, I think, that is fine.

[1] https://www.darktable.org/usermanual/ch03s02.html.php
[2] https://wiki.gnome.org/Apps/Shotwell/Architecture/PhotoPipeline
Comment 1 Debarshi Ray 2016-04-08 18:39:58 UTC
See darktable/tools/iop_dependencies.py for the exact order used by Darktable.
Comment 2 Debarshi Ray 2016-04-08 18:41:21 UTC
Created attachment 325607 [details] [review]
pipeline: Mark nodes as passthrough instead of actually removing them
Comment 3 Debarshi Ray 2016-04-08 18:41:49 UTC
Created attachment 325608 [details] [review]
pipeline: Refactor connecting a list of nodes into a separate function
Comment 4 Debarshi Ray 2016-04-08 18:42:19 UTC
Created attachment 325609 [details] [review]
pipeline: Refactor photos_pipeline_reset to be more extensible
Comment 5 Debarshi Ray 2016-04-08 18:42:58 UTC
Created attachment 325610 [details] [review]
pipeline: Assign a fixed position to gegl:crop
Comment 6 Rafael Fonseca 2016-04-08 19:43:15 UTC
Review of attachment 325607 [details] [review]:

Looks good.

I'll have to update my Discard all edits patch, since it didn't account for pass-through nodes.
Comment 7 Rafael Fonseca 2016-04-08 19:45:32 UTC
Review of attachment 325608 [details] [review]:

Nice.
Comment 8 Rafael Fonseca 2016-04-08 20:10:08 UTC
Review of attachment 325609 [details] [review]:

Looks good overall.

::: src/photos-pipeline.c
@@ +109,3 @@
+      node = gegl_node_new_child (self->graph, "operation", OPERATIONS[i], NULL);
+      gegl_node_set_passthrough (node, TRUE);
+      g_hash_table_insert (self->hash, g_strdup (OPERATIONS[i]), g_object_ref (node));

Could we avoid strdup'ing the operations' names for every pipeline? If we don't pass a g_free when creating the hash, we could just point to the string in the static array.
Comment 9 Debarshi Ray 2016-04-11 10:02:23 UTC
(In reply to Rafael Fonseca from comment #8)
> Review of attachment 325609 [details] [review] [review]:
> ::: src/photos-pipeline.c
> @@ +109,3 @@
> +      node = gegl_node_new_child (self->graph, "operation", OPERATIONS[i],
> NULL);
> +      gegl_node_set_passthrough (node, TRUE);
> +      g_hash_table_insert (self->hash, g_strdup (OPERATIONS[i]),
> g_object_ref (node));
> 
> Could we avoid strdup'ing the operations' names for every pipeline? If we
> don't pass a g_free when creating the hash, we could just point to the
> string in the static array.

We can remove the strdup once we no longer need to insert operation names that point to non-static memory. eg., in photos_pipeline_add and when deserializing the XML. I think we can handle photos_pipeline_add when we have a fixed position for everything. It needs some research on the placement of the other operations. Then, we can populate an empty graph before deserialization, read the properties and update the existing nodes, instead of creating new nodes.
Comment 10 Debarshi Ray 2016-09-09 11:01:03 UTC
Comment on attachment 325607 [details] [review]
pipeline: Mark nodes as passthrough instead of actually removing them

Pushed to master after tweaking the commit message to be less rambling.
Comment 11 Debarshi Ray 2016-09-09 12:14:48 UTC
Review of attachment 325608 [details] [review]:

::: src/photos-pipeline.c
@@ +69,3 @@
+
+  node = GEGL_NODE (nodes->data);
+  gegl_node_link (input, node);

Would be nice to handle nodes == NULL, because it will simplify the calling function even more.
Comment 12 Debarshi Ray 2016-09-09 12:29:29 UTC
(In reply to Rafael Fonseca from comment #8)
Sorry for not replying sooner. This bug fell off my radar.

> Review of attachment 325609 [details] [review] [review]:
> ::: src/photos-pipeline.c
> @@ +109,3 @@
> +      node = gegl_node_new_child (self->graph, "operation", OPERATIONS[i],
> NULL);
> +      gegl_node_set_passthrough (node, TRUE);
> +      g_hash_table_insert (self->hash, g_strdup (OPERATIONS[i]),
> g_object_ref (node));
> 
> Could we avoid strdup'ing the operations' names for every pipeline? If we
> don't pass a g_free when creating the hash, we could just point to the
> string in the static array.

Yes, good point. I think we can do it once we have figured out fixed positions for all the operations, because then all the strings would be in OPERATIONS.
Comment 13 Debarshi Ray 2016-09-09 12:31:07 UTC
Created attachment 335183 [details] [review]
pipeline: Refactor connecting a list of nodes into a separate function
Comment 14 Debarshi Ray 2016-09-09 12:39:15 UTC
These patches solve the problem with cropping interfering with vignettes. Plus, once an image has been edited, the order of the operations should should stay the same unless we revert back to the original. The ordering is:
  crop -> magic-filter -> (others - in the order in which they were 1st used)

We don't interfere with the order of edits done by previous versions of the application.

This should address the most pressing problems. In future, I think we should do what other non-destructive editors (Darktable and Shotwell) have been doing. See below:

(In reply to Debarshi Ray from comment #0)
> Secondly, we should move towards having fixed positions for all the
> operations. That is what prominent non-destructive editors do. eg.,
> Darktable [1] and Shotwell [2]. We won't be able to change the order for
> images edited in previous versions because it is already baked in the XML,
> and, I think, that is fine.
> 
> [1] https://www.darktable.org/usermanual/ch03s02.html.php
> [2] https://wiki.gnome.org/Apps/Shotwell/Architecture/PhotoPipeline

(In reply to Debarshi Ray from comment #1)
> See darktable/tools/iop_dependencies.py for the exact order used by
> Darktable.