Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add audioop.byteswap() #63840

Closed
serhiy-storchaka opened this issue Nov 18, 2013 · 5 comments
Closed

Add audioop.byteswap() #63840

serhiy-storchaka opened this issue Nov 18, 2013 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 19641
Nosy @serhiy-storchaka
Files
  • audioop_byteswap.patch
  • audioop_byteswap_2.patch
  • audioop_byteswap_3.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2013-11-23.20:29:14.138>
    created_at = <Date 2013-11-18.10:25:07.337>
    labels = ['type-feature', 'library']
    title = 'Add audioop.byteswap()'
    updated_at = <Date 2013-11-23.20:29:14.136>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2013-11-23.20:29:14.136>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2013-11-23.20:29:14.138>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2013-11-18.10:25:07.337>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['32686', '32688', '32749']
    hgrepos = []
    issue_num = 19641
    keywords = ['patch']
    message_count = 5.0
    messages = ['203273', '203284', '203601', '204100', '204101']
    nosy_count = 2.0
    nosy_names = ['python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue19641'
    versions = ['Python 3.4']

    @serhiy-storchaka
    Copy link
    Member Author

    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 bpo-19276, bpo-19633).

    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.

    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 18, 2013
    @serhiy-storchaka
    Copy link
    Member Author

    Updated patch addresses some Victor's comments. Added optimization for trivial case byteswap(bytes, 1).

    @serhiy-storchaka
    Copy link
    Member Author

    The patch is synchronized with tip (after committing bpo-19633). It enables temporary disabled in bpo-19633 tests.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 23, 2013

    New changeset fbebc90abcd1 by Serhiy Storchaka in branch 'default':
    Issue bpo-19641: Added the audioop.byteswap() function to convert big-endian
    http://hg.python.org/cpython/rev/fbebc90abcd1

    @serhiy-storchaka
    Copy link
    Member Author

    I have committed simplified patch, without optimization for 1-byte samples.

    @serhiy-storchaka serhiy-storchaka self-assigned this Nov 23, 2013
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant