src/hb-repacker.hh


Log

Author Commit Date CI Message
Qunxin Liu a35757c6 2022-02-02T10:30:34 [repacker] expose hb_subset_repack() API, hb_object_t and hb_link_t structs
Garret Rieger 112cb9fe 2022-01-19T15:31:35 [repacker] Fix missing initilization of obj in vertex_t.
Behdad Esfahbod 15cceff3 2022-01-17T15:53:01 [repacker] Replace fini_deep() with fini() Vector calls destructor now.
luz paz e2e30506 2022-01-16T07:00:53 Fix various typos Found via `codespell -q 3 -S ./perf/texts -L actualy,ba,beng,fo,gir,inout,nd,ot,pres,ro,te,teh,timne`
Garret Rieger c4573c2e 2021-12-14T14:49:15 [repacker] don't infinite loop if visited or roots is in error. Fixes https://oss-fuzz.com/testcase-detail/5205038086094848
Garret Rieger 5914acb3 2021-12-10T10:05:47 [repacker] Clear distance and position cache when assigning a new space. A change in space will effect the distance assigned to the node and any of it's children so clear the distance cache.
Garret Rieger be2c488e 2021-12-09T15:44:06 [repacker] Improve vertex priority packing. Previous priority implementation would move a node further back within it's layer, but at max priority was unable to move any further up than that. This updates the implementation to have 3 priority levels: 1. Distance is reduced by half of table size. 2. Distance is reduced by full table size (move to beginning of the layer). 3. Distance is set to 0. Vertex will be packed as soon as possible. Also makes the iterative resolutions aware of max priority, so it won't keep trying to raise priority beyond the maximum.
Garret Rieger 3e4a2509 2021-12-06T16:00:15 [repacker] add a maximum number of roots that can be moved in one iteration. Set to half of the roots in a space. This prevents the repacker from moving all roots in a space to a new space if their are overflows in every root.
Garret Rieger 02b12d79 2021-12-06T15:23:35 [repacker] Move all overflowing roots to a new space simultaneously.
Garret Rieger fa966bcc 2021-12-06T12:54:19 [repacker] create repacker output buffer after final length is known. Don't rely on a buffer provided by the caller, as it may not be large enough.
Garret Rieger 39e76af1 2021-11-30T15:25:40 [subset] add all_links () to object_t. Helper to provide easy access to concatenated real and virtual links iterator.
Garret Rieger 9121ed0c 2021-11-30T13:45:22 [subset] Improve sharing of Ligature subtables. Ligature subtables use virtual links to enforce an ordering constraint between the subtables and the coverage table. Unfortunately this has the sideeffect of prevent the subtables from being shared by another Ligature with a different coverage table since object equality compares all links real and virtual. This change makes virtual links stored separately from real links and updates the equality check to only check real links. If an object is de-duped any virtual links it has are merged into the object that replaces it.
Garret Rieger 7615b94e 2021-09-23T14:14:06 [repacker] add 'virtual links' to the serializer. These aren't associated with an offset field, but instead exist solely to add an ordering constraint to the object graph.
Behdad Esfahbod 8c055699 2021-11-01T17:59:17 [algs] Add hb_swap() ala, and using, std::swap() Use it in vector. Use ADL idiom.
Behdad Esfahbod 42626369 2021-10-23T13:18:22 Merge pull request #3248 from googlefonts/connected_components [repacker] Keep connected subgraphs in the same space.
Garret Rieger d17155f5 2021-10-13T14:40:00 [repacker] use possibly updated root idx after isolate_subgraph. isolate_subgraph can change the root indices in some cases. So operations after the isolation need to use the roots from the output of isolate_subgraph.
Behdad Esfahbod a7a36085 2021-10-12T16:11:25 [docs] Rename overflow_resolution to repacker
Garret Rieger 6bc64317 2021-10-12T13:13:32 Add a writeup of the overflow resolution algorithm in harfbuzz.
Garret Rieger 5b882c42 2021-10-06T11:12:32 [repacker] performance optimizations for topological sorting. - Presize the output sorted graph and write it once in the correct order to avoid needing to reverse. - Swap the old/new graph vectors instead of copying. - Use a boolean vector for tracking visited instead of a set.
Garret Rieger ff7a86e9 2021-10-06T10:51:45 [repacker] remove clone buffer, they are unnessecary. When nodes are duplicated it's fine to just reuse head, tail from the node being cloned since we don't modify the contents.
Garret Rieger 8cae8b65 2021-10-05T14:03:02 [repacker] add missing fini for parents vector.
Garret Rieger 7883b7ed 2021-10-05T12:46:59 [repacker] Add additional splitting spaces test. Fix issues it uncovered.
Garret Rieger d97bd426 2021-10-05T10:53:05 [repacker] when assigning spaces use post isolation node indices. isolate_subgraph can result in some of the roots being duplicated and moved to new indices, so do subgraph isolation before assign roots to spaces.
Garret Rieger 375a6c8f 2021-09-29T18:14:57 [repacker] add the ability to move subgraphs from a shared space into their own space. Used to resolve overflows during manual resolution.
Garret Rieger 0dccbf36 2021-09-29T14:28:27 [repacker] Handle the case where a subgraph root has an incoming 32 and 16 bit edge. In this case the entire subgraph from that root will be duplicated.
Garret Rieger 816c5302 2021-09-28T16:04:27 [repacker] restrict 32 bit subgraph connected component search to only nodes reachable via directed links.
Garret Rieger 67eb222b 2021-09-28T13:36:06 [repacker] when assigning each connected subgraph a space, also isolate it. This will break any links coming from space 0 (ie. the 16 bit offset only space).
Garret Rieger 307acf7f 2021-09-28T12:08:18 [repacker] add space assignment based on connected components. Assign each connected component that is underneath one or more 32 bit offsets into a unique space. This ensures that 32 bit subgraphs which are connected are packed into the same space.
Garret Rieger c77bdf1d 2021-09-24T15:58:57 [repacker] begin storing each nodes parents. Will be used for connected component search.
Garret Rieger efda2f14 2021-09-24T16:28:34 [repacker] fix bug in subgraph isolation. Prior to this fix id remapping at the end of the isolation operation was fed the old subgraph instead of the new one. Which results in object indices being remapped for the nodes outside of the new subgraph. Adds a test which detects this problem.
Garret Rieger fe155de9 2021-09-10T14:55:24 [repacker] handle a couple of duplication edge cases. - Detect cases where there are multiple links from a parent to a child. Don't duplicate that child if those are the only remaining links to the child. - Correctly handle isolating a subgraph where the root idx has multiple incoming links.
Garret Rieger c19ec97d 2021-09-09T10:53:09 [repacker] reduce the bits used by order by 2 to give more bits to distance.
Garret Rieger d0daa7a5 2021-09-09T10:25:43 [repacker] add a couple more complex isolation tests.
Garret Rieger 62c502cd 2021-09-09T09:57:42 [repacker] correctly update incoming_edges in duplicate.
Garret Rieger a57ef8df 2021-09-08T17:31:39 [repacker] default space to 0. Since vector push() init's new objects to all zeros.
Garret Rieger 58facaad 2021-09-08T16:08:48 [repacker] put each 32 bit subgraph into it's own packing space. Each subgraph pointed to by a 32 bit offset should be packed into it's own space. This adds a space property to vertices which affects the distance calculation. This effectively places the distances for all of the nodes of a 32 bit subgraph into a distinct range. Thus all of the nodes of the subgraph will be packed together.
Garret Rieger 543a3f97 2021-09-08T15:07:02 [repacker] Add repacker test for subgraph isolation.
Garret Rieger 7147f169 2021-09-08T13:44:25 [repacker] recursively duplicate nodes during isolation. If a node is duplicated during isolation then any children it has will have incoming links from outside the subgraph (from the duplicated node and the original node), so they must be duplicated too.
Garret Rieger 41bbf281 2021-09-08T10:14:00 [repacker] do extension subtable isolation before starting resolution attempts.
Garret Rieger 8d8b7458 2021-09-07T16:52:37 [repacker] extract overflows processing into its own method.
Garret Rieger b14b3f13 2021-09-07T16:32:13 [repacker] begin implementing the ability to isolate extension subtables. Adds isolate_subgraph operation to the repacker. This severs any links from outside a subgraph by duplicating the affected vertices. This will be used to isolate the subgraphs of a extension subtable from the rest of object graph. Thus allowing the extension subtable to be packed far away from the rest of the objects.
Garret Rieger 02c4a516 2021-09-07T13:22:19 Add a debug message when offset overflow resolution fails.
Garret Rieger 74f96d9d 2021-09-17T13:46:07 [repacker] fix heap use after free in repacker. Don't store a reference to the link in overflow records as the link object may be freed if the sorted graph vector is resized.
Behdad Esfahbod 2337f0d0 2021-07-08T10:58:50 Internally use hb_malloc/.../hb_free instead of malloc/.../free Redefining those stock names as macros was conflicting with gcc 10 headers. Fixes https://github.com/harfbuzz/harfbuzz/issues/3044
Garret Rieger 5e0ec33b 2021-05-12T14:46:54 Error when link width not in [2, 4]
Qunxin Liu b23f29bf 2021-04-17T09:59:45 [subset] Add subset () method for COLRv1 Paint tables, BaseGlyphV1List and LayerV1List Also add support for Offset24 in serializer and repacker
Garret Rieger ec432106 2021-04-19T17:18:05 [subset] fix infinite loop caused by alloc failure in repacker. Fixes: https://oss-fuzz.com/testcase-detail/5609112151916544.
Garret Rieger 0e845d97 2021-04-19T16:09:37 [subset] fix memory leak in repacker caused by failed alloc. Fixes: https://oss-fuzz.com/testcase-detail/5616763250278400.
Garret Rieger 71d6d156 2021-04-05T12:03:17 [subset] clamp distance to prevent shifting outside of the limits of int64. Fixes https://oss-fuzz.com/testcase-detail/4961171477233664.
Garret Rieger c5c13006 2021-03-31T11:23:46 [subset] fix memory leaks found in https://oss-fuzz.com/testcase-detail/5179935334465536
Garret Rieger 3827a3eb 2021-03-18T11:20:03 [subset] rename serializer::set_error() to err().
Garret Rieger f561fa6e 2021-03-18T11:13:47 Change priority queue to use (priority, value) instead of (value, priority).
Garret Rieger b14475d2 2021-03-18T10:51:26 [subset] further changes to serializer error handling. - Rename enum type and enum members. - in_errors() now returns true for any error having been set. hb-subset now looks for offset overflow only errors to divert to repacker. - Added INT_OVERFLOW and ARRAY_OVERFLOW enum values.
Garret Rieger 73ed59f7 2021-03-17T15:53:10 [subset] store errors in the serializer as a flag set. Make check_assign/check_equal specify the type of error to set.
Garret Rieger cf79fc34 2021-02-16T13:24:43 [subset] limit priority bumps to 16.
Garret Rieger d3e2ba7c 2020-11-11T13:50:18 [subset] comment cleanup in hb-repacker.hh
Garret Rieger bb5c80a7 2020-11-10T14:11:57 [subset] add error tracking to the repacker. Also check for allocation failures as needed.
Garret Rieger 6e9468fc 2020-11-09T16:52:36 [subset] cleanup memory leaks in the repacker.
Garret Rieger a7a86a6e 2020-11-06T16:22:48 [subset] Add prioritization offset resolution. Vertices can now be prioritized to force them to sort closer to their parent. The resolver will attempt to use this for overflows on non-shared vertices.
Garret Rieger b452b2c7 2020-11-06T15:37:05 [subset] refactor repacker graph to cache edge count and distances of vertices.
Garret Rieger 75414e82 2020-11-05T16:39:23 [subset] Add table duplication overflow resolution.
Garret Rieger 8286bd80 2020-11-05T14:23:29 [subset] use vectors instead of hashmaps throughout the repacker since all keys will be mapped for these use cases.
Garret Rieger 519ae966 2020-11-05T11:22:16 [subset] switch sort_shortest_distance() to use priority queue.
Garret Rieger 5d3511e5 2020-11-05T10:34:26 [subset] Change compute_distances() to use a priority queue.
Garret Rieger 4c8dd41e 2020-11-05T09:21:25 [subset] re-write compute distances to use an array lookup for the distance map.
Garret Rieger aaa7873d 2020-11-02T16:16:27 [subset] add topological sort by closest distance via Dijkstra's algorithm.
Garret Rieger 8ebe5d73 2020-11-02T14:51:39 Implement will_overflow ().
Garret Rieger f4c78cc7 2020-10-30T10:29:51 [subset] Implement Kahn's algo for topological sorting instead of BFS.
Garret Rieger 00f393dc 2020-10-29T14:58:34 [subset] finish up BFS sort implementation.
Garret Rieger 1584d3cb 2020-10-28T17:49:09 [subset] Start a proof of concept implementation of the GSUB/GPOS offset overflow resolver.