Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 21 Apr 2019, 12:25
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
minimp3 source code
Post new topic   Reply to topic View previous topic :: View next topic
Page 4 of 4 [50 Posts]   Goto page: Previous 1, 2, 3, 4
Author Message
Ibidem

Joined: 25 May 2010
Posts: 553
Location: State of Jefferson

PostPosted: Sat 16 May 2015, 20:46    Post subject:  

Having downloaded those recordings a while ago, I tried it out.
Results:
-Same errors when played without modification
-id3 and id3tool don't recognize the id3 tags, but id3v2 can remove them.
-mp3dec_opt plays the result nicely, at ~25% CPU on my 1.6GHz Atom N270.
-mp3dec plays the result, but runs ~66% CPU.
I'll try out the id3 tag stripper referred to.

UPDATE:
Yup, the id3 tag stripper works (meaning it removes enough); <unistd.h> should be added, though.
It does point out an issue with the PDMP3 code:
the API and code almost seem like they were designed to prevent use with pipes.
- rather than passing a file handle / descriptor, you copy a name to the global
Code:
char filename[256]
(256 is the max length for a file name...without a path!).
- it apparently checks if it has hit the end of the file, via ftell(), rather than whether reading has failed; if ftell() fails, it is treated as an EOF.
- the overuse of globals results in the relevant code being rather well hidden.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4853
Location: Blue Springs, MO

PostPosted: Sun 17 May 2015, 11:10    Post subject:  

Ibidem wrote:
Having downloaded those recordings a while ago, I tried it out.
Results:
-Same errors when played without modification
-id3 and id3tool don't recognize the id3 tags, but id3v2 can remove them.
-mp3dec_opt plays the result nicely, at ~25% CPU on my 1.6GHz Atom N270.
-mp3dec plays the result, but runs ~66% CPU.
I'll try out the id3 tag stripper referred to.

UPDATE:
Yup, the id3 tag stripper works (meaning it removes enough); <unistd.h> should be added, though.
It does point out an issue with the PDMP3 code:
the API and code almost seem like they were designed to prevent use with pipes.
- rather than passing a file handle / descriptor, you copy a name to the global
Code:
char filename[256]
(256 is the max length for a file name...without a path!).
- it apparently checks if it has hit the end of the file, via ftell(), rather than whether reading has failed; if ftell() fails, it is treated as an EOF.
- the overuse of globals results in the relevant code being rather well hidden.


I am working on those ... as to resource usage, I added lookup tables for the IMDCT cos function which can be enabled with the CFLAG -DIMDCT_NTABLES ... that reduces CPU usage to ~15% after initialization.
Also need to set up a separate initialization function.

Edit:
I have updated https://github.com/technosaurus/PDMP3 with my current code and added a todo list in the readme.md ... For further issues, please add an issue via github.

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
Ibidem

Joined: 25 May 2010
Posts: 553
Location: State of Jefferson

PostPosted: Tue 19 May 2015, 11:54    Post subject:  

technosaurus wrote:

I am working on those ... as to resource usage, I added lookup tables for the IMDCT cos function which can be enabled with the CFLAG -DIMDCT_NTABLES ... that reduces CPU usage to ~15% after initialization.
Also need to set up a separate initialization function.

Edit:
I have updated https://github.com/technosaurus/PDMP3 with my current code and added a todo list in the readme.md ... For further issues, please add an issue via github.


Thanks for the IDMCT bit!
You have a new pull request on github. Wink
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4853
Location: Blue Springs, MO

PostPosted: Wed 20 May 2015, 01:19    Post subject:  

Ibidem wrote:
Thanks for the IDMCT bit!
You have a new pull request on github. Wink
Merged. Thanks!
Anytime you see a function that requires #include <math.h>, its a good hint that it could use a lookup table pow*(), sin*(), cos*(), tan*(), etc...
Keep in mind that each chunk of data corresponds to ~20ms, so it needs to be processed very quickly (most programs take longer than 20ms just to load)
I got a bit better cpu load (slightly larger binary) by doing -fprofile-generate (running it) and then -fprofile-use

Edit::Here are the gperf results, Looks like L3_Subband_Synthesis and L3_Reorder alon with reading the data are the hot spots.
Code:
Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  us/call  us/call  name   
 56.82      0.25     0.25                             L3_Subband_Synthesis
 27.27      0.37     0.12                             L3_Reorder
  6.82      0.40     0.03   437169     0.07     0.07  __do_global_dtors_aux
  4.55      0.42     0.02   181361     0.11     0.11  Read_Header
  2.27      0.43     0.01    78785     0.13     0.13  Get_Bytes
  2.27      0.44     0.01                             Get_Side_Bits
  0.00      0.44     0.00   167430     0.00     0.00  Get_Main_Pos
  0.00      0.44     0.00     9734     0.00     0.00  frame_dummy
  0.00      0.44     0.00     2629     0.00     0.00  Requantize_Pow_43
  0.00      0.44     0.00     1859     0.00     2.29  Read_Audio_L3

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
musher0

Joined: 04 Jan 2009
Posts: 13918
Location: Gatineau (Qc), Canada

PostPosted: Fri 22 Mar 2019, 16:23    Post subject:  

technosaurus wrote:
I reworked Krister Lagerstrom's public domain code a bit... my modifications are also public domain... work is still in progress adding the optimizations in as compile time options, but the big ones are there, (however if you want to add more optimizations, see https://github.com/technosaurus/PDMP3)

You can use this in any project, commercial or otherwise without attribution (I'm still working on making this part easy though - patches welcome)
Thanks again for this, tehcnosaurus!
_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 4 of 4 [50 Posts]   Goto page: Previous 1, 2, 3, 4
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0616s ][ Queries: 13 (0.0224s) ][ GZIP on ]