{"action":"created","issue":{"url":"https://api.github.com/repos/diydrones/ardupilot/issues/3497","labels_url":"https://api.github.com/repos/diydrones/ardupilot/issues/3497/labels{/name}","comments_url":"https://api.github.com/repos/diydrones/ardupilot/issues/3497/comments","events_url":"https://api.github.com/repos/diydrones/ardupilot/issues/3497/events","html_url":"https://github.com/diydrones/ardupilot/pull/3497","id":126463774,"number":3497,"title":"VideoIn: add benchmarks and improve performance of crop_8bpp() and yuyv_to_grey()","user":{"login":"ricardotk","id":3178975,"avatar_url":"https://avatars.githubusercontent.com/u/3178975?v=3","gravatar_id":"","url":"https://api.github.com/users/ricardotk","html_url":"https://github.com/ricardotk","followers_url":"https://api.github.com/users/ricardotk/followers","following_url":"https://api.github.com/users/ricardotk/following{/other_user}","gists_url":"https://api.github.com/users/ricardotk/gists{/gist_id}","starred_url":"https://api.github.com/users/ricardotk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricardotk/subscriptions","organizations_url":"https://api.github.com/users/ricardotk/orgs","repos_url":"https://api.github.com/users/ricardotk/repos","events_url":"https://api.github.com/users/ricardotk/events{/privacy}","received_events_url":"https://api.github.com/users/ricardotk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/diydrones/ardupilot/labels/Linux","name":"Linux","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-01-13T16:53:28Z","updated_at":"2016-01-14T13:36:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/diydrones/ardupilot/pulls/3497","html_url":"https://github.com/diydrones/ardupilot/pull/3497","diff_url":"https://github.com/diydrones/ardupilot/pull/3497.diff","patch_url":"https://github.com/diydrones/ardupilot/pull/3497.patch"},"body":"This PR adds benchmarks using gbenchmark and improve performance of\r\ncrop_8bpp() and yuyv_to_grey()."},"comment":{"url":"https://api.github.com/repos/diydrones/ardupilot/issues/comments/171646444","html_url":"https://github.com/diydrones/ardupilot/pull/3497#issuecomment-171646444","issue_url":"https://api.github.com/repos/diydrones/ardupilot/issues/3497","id":171646444,"user":{"login":"ricardotk","id":3178975,"avatar_url":"https://avatars.githubusercontent.com/u/3178975?v=3","gravatar_id":"","url":"https://api.github.com/users/ricardotk","html_url":"https://github.com/ricardotk","followers_url":"https://api.github.com/users/ricardotk/followers","following_url":"https://api.github.com/users/ricardotk/following{/other_user}","gists_url":"https://api.github.com/users/ricardotk/gists{/gist_id}","starred_url":"https://api.github.com/users/ricardotk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricardotk/subscriptions","organizations_url":"https://api.github.com/users/ricardotk/orgs","repos_url":"https://api.github.com/users/ricardotk/repos","events_url":"https://api.github.com/users/ricardotk/events{/privacy}","received_events_url":"https://api.github.com/users/ricardotk/received_events","type":"User","site_admin":false},"created_at":"2016-01-14T13:36:38Z","updated_at":"2016-01-14T13:36:38Z","body":">instead of going assembly, try enabling the compiler (via CXXFLAGS) to generate optimized instructions and compare to the ones without. For MinnowBoard Max that would be:\r\n-march=corei7 -mtune=corei7 -mfpmath=sse -msse4.2\r\n\r\n>For ARM I think this would be: -mfpu=neon -ffast-math\r\n\r\n@lucasdemarchi we've got even better results with these flags (:\r\n\r\nAt least for the `yuyv_to_grey()` its very clear the gain in performance.\r\n\r\nWithout the flags:\r\n\r\nBenchmark | Time (ns) | CPU(ns) | Iterations\r\n---------------|--------------|-------------|-------------\r\nBM_Crop8bpp/64/64      |   2655    |   2651    | 218750                                 \r\nBM_Crop8bpp/240/240    |  33617   |   33667    |  20792                                 \r\nBM_Crop8bpp/640/480    | 188022    | 188201   |    3684                                 \r\nBM_YuyvToGrey/4k   |       1714   |    1717   |  403847                                 \r\nBM_YuyvToGrey/75k     |   32148    |  32180   |   21649                                 \r\nBM_YuyvToGrey/300k    |  128647   |  128753    |   5385 \r\n\r\nWith the flags:\r\n\r\nBenchmark | Time (ns) | CPU(ns) | Iterations\r\n---------------|--------------|-------------|-------------\r\nBM_Crop8bpp/64/64     |          2644    |     2643  |   232103                                 \r\nBM_Crop8bpp/240/240   |      33413  |     33346  |     20792                                 \r\nBM_Crop8bpp/640/480    |   174583  |   174154     |    3962                                 \r\nBM_YuyvToGrey/4k      |          1149     |    1150  |   599998                                 \r\nBM_YuyvToGrey/75k      |      22135    |   22146   |    32813                                 \r\nBM_YuyvToGrey/300k      |    85989   |    86140      |   7778\r\n"}}