{"action":"created","issue":{"url":"https://api.github.com/repos/PaulStoffregen/Audio/issues/152","labels_url":"https://api.github.com/repos/PaulStoffregen/Audio/issues/152/labels{/name}","comments_url":"https://api.github.com/repos/PaulStoffregen/Audio/issues/152/comments","events_url":"https://api.github.com/repos/PaulStoffregen/Audio/issues/152/events","html_url":"https://github.com/PaulStoffregen/Audio/issues/152","id":126949498,"number":152,"title":"assembler for copy_to_fft_buffer in fft","user":{"login":"FrankBoesing","id":2457514,"avatar_url":"https://avatars.githubusercontent.com/u/2457514?v=3","gravatar_id":"","url":"https://api.github.com/users/FrankBoesing","html_url":"https://github.com/FrankBoesing","followers_url":"https://api.github.com/users/FrankBoesing/followers","following_url":"https://api.github.com/users/FrankBoesing/following{/other_user}","gists_url":"https://api.github.com/users/FrankBoesing/gists{/gist_id}","starred_url":"https://api.github.com/users/FrankBoesing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrankBoesing/subscriptions","organizations_url":"https://api.github.com/users/FrankBoesing/orgs","repos_url":"https://api.github.com/users/FrankBoesing/repos","events_url":"https://api.github.com/users/FrankBoesing/events{/privacy}","received_events_url":"https://api.github.com/users/FrankBoesing/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-15T20:14:51Z","updated_at":"2016-01-16T11:27:28Z","closed_at":null,"body":"Hi Paul, \r\n\r\ncopy_to_fft_buffer could be speed up by a factor of two with the following change:\r\n\r\nmemcpy_tointerleaveL((int16_t*)destination,(int16_t*)source); //First half\r\nmemcpy_tointerleaveL((int16_t*)destination + AUDIO_BLOCK_SAMPLES,(int16_t*)source + AUDIO_BLOCK_SAMPLES/2); //Second half\r\n\r\n(two calls of memcpy_tointerleaveL)\r\n\r\nSome additional cycles could be saved with a specialized routine.\r\n\r\nI want to do a pull-request\r\nDo you want a specialzed routine with more speed or the solution above with two calls which re-uses the existing code ?\r\n"},"comment":{"url":"https://api.github.com/repos/PaulStoffregen/Audio/issues/comments/172191627","html_url":"https://github.com/PaulStoffregen/Audio/issues/152#issuecomment-172191627","issue_url":"https://api.github.com/repos/PaulStoffregen/Audio/issues/152","id":172191627,"user":{"login":"FrankBoesing","id":2457514,"avatar_url":"https://avatars.githubusercontent.com/u/2457514?v=3","gravatar_id":"","url":"https://api.github.com/users/FrankBoesing","html_url":"https://github.com/FrankBoesing","followers_url":"https://api.github.com/users/FrankBoesing/followers","following_url":"https://api.github.com/users/FrankBoesing/following{/other_user}","gists_url":"https://api.github.com/users/FrankBoesing/gists{/gist_id}","starred_url":"https://api.github.com/users/FrankBoesing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrankBoesing/subscriptions","organizations_url":"https://api.github.com/users/FrankBoesing/orgs","repos_url":"https://api.github.com/users/FrankBoesing/repos","events_url":"https://api.github.com/users/FrankBoesing/events{/privacy}","received_events_url":"https://api.github.com/users/FrankBoesing/received_events","type":"User","site_admin":false},"created_at":"2016-01-16T11:27:28Z","updated_at":"2016-01-16T11:27:28Z","body":"\nOk,\njust for the records, this would be the new code:\n\n#include \"memcpy_audio.h\"\n\nstatic void copy_to_fft_buffer(void *destination, const void *source)\n{\n     #if defined(__MK20DX128__) || defined(__MK20DX256__) || \ndefined(__MK66FX1M0__)\n     //160115 Frank Bösing use assembler.\n     //Could be some cylcles faster with a specialized routine\nmemcpy_tointerleaveL((int16_t*)destination,(int16_t*)source); //First half\n     memcpy_tointerleaveL((int16_t*)destination + \nAUDIO_BLOCK_SAMPLES,(int16_t*)source + AUDIO_BLOCK_SAMPLES/2); //Second half\n     #else\n   // 140312 - PAH - slightly faster copy\n     const uint16_t *src = (const uint16_t *)source;\n     uint32_t *dst = (uint32_t *)destination;\n\n     for (int i=0; i < AUDIO_BLOCK_SAMPLES; i++) {\n         *dst++ = *src++;  // real sample plus a zero for imaginary\n     }\n     #endif\n}\n\nRegards,\nFrank.\n"}}