Issue 19641: Add audioop.byteswap() - Python tracker (original) (raw)

Issue19641

Created on 2013-11-18 10:25 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
audioop_byteswap.patch serhiy.storchaka,2013-11-18 10:25 review
audioop_byteswap_2.patch serhiy.storchaka,2013-11-18 11:58 review
audioop_byteswap_3.patch serhiy.storchaka,2013-11-21 10:14 review
Messages (5)
msg203273 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-11-18 10:25
The audio modules often need convert between little endian and big endian data. The array module can be used to byteswap 16- and 32-bit samples, but it can't help with 24-bit samples. Python implemented function for swapping bytes is not very efficient. In any case the use of array is not so simple (see , ). The proposed patch adds efficient byteswap() function in the audioop module. byteswap(fragment, width) byteswaps every "width"-byte sample in the fragment and returns modified data.
msg203284 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-11-18 11:58
Updated patch addresses some Victor's comments. Added optimization for trivial case byteswap(bytes, 1).
msg203601 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-11-21 10:14
The patch is synchronized with tip (after committing ). It enables temporary disabled in tests.
msg204100 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-23 20:27
New changeset fbebc90abcd1 by Serhiy Storchaka in branch 'default': Issue #19641: Added the audioop.byteswap() function to convert big-endian http://hg.python.org/cpython/rev/fbebc90abcd1
msg204101 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-11-23 20:29
I have committed simplified patch, without optimization for 1-byte samples.
History
Date User Action Args
2022-04-11 14:57:53 admin set github: 63840
2013-11-23 20:29:14 serhiy.storchaka set status: open -> closedmessages: + assignee: serhiy.storchakaresolution: fixedstage: patch review -> resolved
2013-11-23 20:27:40 python-dev set nosy: + python-devmessages: +
2013-11-21 10:14:30 serhiy.storchaka set files: + audioop_byteswap_3.patchmessages: +
2013-11-18 11:58:24 serhiy.storchaka set files: + audioop_byteswap_2.patchmessages: +
2013-11-18 10:25:07 serhiy.storchaka create