{"action":"created","issue":{"url":"https://api.github.com/repos/opencv/opencv/issues/13392","repository_url":"https://api.github.com/repos/opencv/opencv","labels_url":"https://api.github.com/repos/opencv/opencv/issues/13392/labels{/name}","comments_url":"https://api.github.com/repos/opencv/opencv/issues/13392/comments","events_url":"https://api.github.com/repos/opencv/opencv/issues/13392/events","html_url":"https://github.com/opencv/opencv/pull/13392","id":388695484,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM2OTAwMDY2","number":13392,"title":"Reworked separable filter to use wide universal intrinsics","user":{"login":"terfendail","id":13571155,"node_id":"MDQ6VXNlcjEzNTcxMTU1","avatar_url":"https://avatars2.githubusercontent.com/u/13571155?v=4","gravatar_id":"","url":"https://api.github.com/users/terfendail","html_url":"https://github.com/terfendail","followers_url":"https://api.github.com/users/terfendail/followers","following_url":"https://api.github.com/users/terfendail/following{/other_user}","gists_url":"https://api.github.com/users/terfendail/gists{/gist_id}","starred_url":"https://api.github.com/users/terfendail/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terfendail/subscriptions","organizations_url":"https://api.github.com/users/terfendail/orgs","repos_url":"https://api.github.com/users/terfendail/repos","events_url":"https://api.github.com/users/terfendail/events{/privacy}","received_events_url":"https://api.github.com/users/terfendail/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-07T15:16:33Z","updated_at":"2018-12-08T06:13:13Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/opencv/opencv/pulls/13392","html_url":"https://github.com/opencv/opencv/pull/13392","diff_url":"https://github.com/opencv/opencv/pull/13392.diff","patch_url":"https://github.com/opencv/opencv/pull/13392.patch"},"body":"### This pullrequest changes\r\nReworked separable filter to use wide universal intrinsics"},"comment":{"url":"https://api.github.com/repos/opencv/opencv/issues/comments/445434918","html_url":"https://github.com/opencv/opencv/pull/13392#issuecomment-445434918","issue_url":"https://api.github.com/repos/opencv/opencv/issues/13392","id":445434918,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTQzNDkxOA==","user":{"login":"kinchungwong","id":2611191,"node_id":"MDQ6VXNlcjI2MTExOTE=","avatar_url":"https://avatars0.githubusercontent.com/u/2611191?v=4","gravatar_id":"","url":"https://api.github.com/users/kinchungwong","html_url":"https://github.com/kinchungwong","followers_url":"https://api.github.com/users/kinchungwong/followers","following_url":"https://api.github.com/users/kinchungwong/following{/other_user}","gists_url":"https://api.github.com/users/kinchungwong/gists{/gist_id}","starred_url":"https://api.github.com/users/kinchungwong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinchungwong/subscriptions","organizations_url":"https://api.github.com/users/kinchungwong/orgs","repos_url":"https://api.github.com/users/kinchungwong/repos","events_url":"https://api.github.com/users/kinchungwong/events{/privacy}","received_events_url":"https://api.github.com/users/kinchungwong/received_events","type":"User","site_admin":false},"created_at":"2018-12-08T06:13:13Z","updated_at":"2018-12-08T06:13:13Z","author_association":"CONTRIBUTOR","body":"**In case you are porting this to branch 4.0**, can we simplify the 2D Filter code by using techniques such as this? \r\n\r\n(I understand this suggestion isn't applicable to branch 3.4 because of dependency on C++11.)\r\n\r\n * Define a nested `std::array` of a wide universal intrinsics vector type\r\n * Store a \"window\" of neighboring pixels in this 2D array of vectors\r\n * Implement a function that extracts a vector worth of data from the center of this window, offset by some rows and columns\r\n * Consume the vector of neighbor values in a convolution filter expression\r\n * Load the next window by reusing some vector values and accessing memory only for the new ones\r\n\r\nThe design goal is to allow, for example, a Sobel 3x3 x-derivative filter to be expressed as:\r\n```cpp\r\nv_int32 result =\r\n\t(input.get<-1, 1>() + input.get<0, 1>() + input.get<0, 1>() + input.get<1, 1>()) -\r\n\t(input.get<-1, -1>() + input.get<0, -1>() + input.get<0, -1>() + input.get<1, -1>());\r\n```\r\n\r\nProof of concept: https://gist.github.com/kinchungwong/ff2392d9454c52253cbfc85b8075bb22 (2018-12-08)\r\n\r\nThe following diagram explains what I mean by \"extracts a vector worth of data from the center of this window, offset by some rows and columns\"\r\n\r\nExample \r\n```\r\n|       | vec 0   |   vec 1     | vec 2   |\r\n| row 0 | 0 1 2 3 |   4 5 6 7   | 8 9 a b |\r\n| row 1 | 0 1 2 3 | [ 4 5 6 7 ] | 8 9 a b |  // square brackets denote center position\r\n| row 2 | 0 1 2 3 |   4 5 6 7   | 8 9 a b |\r\n```\r\nIn this example, center position can be accessed aligned, i.e. no SIMD instruction \r\nrequired if the value is already in CPU register. Otherwise, it is an aligned load.\r\n\r\nAnother example\r\n```\r\n|       | vec 0     | vec 1     |\r\n| row 0 | 0 1   2 3 | 4 5   6 7 |\r\n| row 1 | 0 1 [ 2 3 | 4 5 ] 6 7 |  // square brackets denote center position\r\n| row 2 | 0 1   2 3 | 4 5   6 7 |\r\n```\r\nIn this example, the center position is straddled half-way between two vector.\r\nDepending on CPU architecture, it might be either `PALIGNR`, `v256_permute2x128`, \r\nor something similar. \r\n"}}
{"actor":{"display_login":"kinchungwong"}}