Jump to content

Lossy Compression?


Recommended Posts

Are there any lossy compression algorithms available in autoit?

Currently my script takes 300-600ms to encrypt data, this is mainly because of the length of the data.

I'm currently compressing using quicklz, a lossless compression algorithm, but I would like apply an additional lossy compression algorithm to audio data I'm encrypting, Doing so should reduce encryption time, at the expense of losing a small percentage of the data.

Is there a way to use say the jpeg, or png compression on other binary data, that is not an image?

I swore I saw an example months ago using png compression on files/binary data, but there's so many results it's taking me forever to sort through them.

Can anyone help me locate an answer on this?

The existing png compression example is also lossless, anyone able to point me in the right direction for lossy compression(or something more efficient than lzma/quicklz)?

Edited by nullschritt
Link to comment
Share on other sites

MP3 is very lossy.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

What kind of audio files you are talking about? Wave?

Idea: take off the header of your audio file, fill up an empty bitmap with that data, compress is with JPG.

Or simply use MP3, OggVorbis, Opus, etc.

 

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

I'm currently encoding the audio with lame, is it possible to instruct lame to use mp3 compression?
 
Here is the code I currently have, using lame to encode the audio data. Does anyone know what paramaters I should pass to lame to instruct it to compress the data as mp3?

#include "TCP.au3"
#include "Bass.au3"
#include "BassEnc.au3"
#include "BassExt.au3"
;_Singleton("Eukalyptus Send")
OnAutoItExitRegister("_FreeBass")

 _BASS_Startup()
_BASS_ENCODE_Startup()
_BASS_EXT_STARTUP()
_BASS_RecordInit(-1)
$hRecord = _BASS_RecordStart(44100, 2, 0, $BASS_EXT_RecordProc)

$aBuffer = _BASS_EXT_MemoryBufferCreate()
$hEncoder = _BASS_Encode_Start($hRecord, '"' & @ScriptDir & '\lame" -r -x -b128 -h - -', 0, $BASS_EXT_EncodeProc, $aBuffer[0])
$hClient = _TCP_Client_Create("127.0.0.1", 101)
 
 
 _TCP_RegisterEvent($hClient, $TCP_CONNECT, "Connected")
 _TCP_RegisterEvent($hClient, $TCP_DISCONNECT, "Disconnected")
 
 While 1
$iSize = _BASS_EXT_MemoryBufferGetSize($aBuffer)
    If $iSize Then
        $bMp3Data = _BASS_EXT_MemoryBufferGetData($aBuffer, $iSize)
        $iSent = _TCP_Send($hClient, $bMp3Data)
    EndIf

    Sleep(50)
 WEnd
 
 Func Connected($hSocket, $iError)
 
 If not $iError Then
     ToolTip("CLIENT: Connected!",10,10)
 Else
     ToolTip("CLIENT: Could not connect. Are you sure the server is running?",10,10)
 EndIf
 
 EndFunc
 

 Func Disconnected($hSocket, $iError)
 ToolTip("CLIENT: Connection closed or lost.", 10,10)
 EndFunc
 
 Func _FreeBass()
    TCPShutdown()
    _BASS_Encode_Stop($hEncoder)
    _BASS_RecordFree()
    _BASS_Free()
EndFunc

http://www.autoitscript.com/forum/index.php?app=core&module=attach&section=attach&attach_id=37151

Edit: If I am correct, lame is already encoding it to mp3, if this is the case, how do I reduce the quality of the output data? (it's okay if the audio is slightly garbled, as it's only voice tramission and not actual music.)

Edit Edit: I reduced the bitrate of the data, by half, and it sped up the encryption portion of the code by about 100ms per crypt. Which is acceptable for my needs.(though I expected a greater increase in performance, I would think by halving the bitrate, the size of the data would also halve, but it doesnt seem to be the case.

Edited by nullschritt
Link to comment
Share on other sites

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...