This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Unsupported provider

classification
Title: Add audioop.byteswap()
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: python-dev, serhiy.storchaka
Priority: normal Keywords: patch

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 issue19276, issue19633).

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 issue19633). It enables temporary disabled in issue19633 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:53adminsetgithub: 63840
2013-11-23 20:29:14serhiy.storchakasetstatus: open -> closed
messages: + msg204101

assignee: serhiy.storchaka
resolution: fixed
stage: patch review -> resolved
2013-11-23 20:27:40python-devsetnosy: + python-dev
messages: + msg204100
2013-11-21 10:14:30serhiy.storchakasetfiles: + audioop_byteswap_3.patch

messages: + msg203601
2013-11-18 11:58:24serhiy.storchakasetfiles: + audioop_byteswap_2.patch

messages: + msg203284
2013-11-18 10:25:07serhiy.storchakacreate