Doing some janitorial work (a bit long)

4 messages Options
Embed this post
Permalink
Rogério Brito-2

Doing some janitorial work (a bit long)

Reply Threaded More More options
Print post
Permalink
Hi there, guys.

I don't know if you noticed, but I did a tiny bit of janitorial work on
our project, closing one bug, changing priorities etc.

I also committed a fix to the abx.c tool in misc/ and I think that now
it works at least for little-endian machines (it doesn't work for
big-endian ones; just tested it with my iBook).

Alexander, could you test it under FreeBSD to see if it is too much
system dependent? I don't know how much the sound system of FreeBSD
differs from Linux, but I'm only using the basic Open Sound System at
this time (no ALSA etc---which is Linux only, I think).

There are still some places where the code can be improved (lots of
places, starting with indentation and other small things up to
endianness of code and other things that GCC 4.3 complains about, like a
very long floating point literal being compared to a long double---Yes,
it is that big).

BTW, what is a portable way of swapping the bytes of a int16_t or of a
int32_t? I can write macros for that (they are actually quite easy) or,
better yet, some inline functions, but I don't want to reinvent the
wheel when better, portable ways exist. (I'm mostly concerned with
portability).

Oh, and since Robert asked for evaluation of samples to see if the
quality increases/decreases, I have to give congratulations to you all.
The work you've done lately is amazing regarding the quality of lame:
since now the abx tool works correctly on my x86-64 system at least, I
could test some of my music and I have a really hard time deciding
between the original samples and things compressed with "lame --resample
44100 -V 8 bla.wav". Of course, I'm no guruboolez. :-)

Impressive. I think that with earphones I could identify the -V 8
encoded files, but I would have a hard time with -V 7 samples. This
means that my 1GB generic MP3 player is going to get more music. :-)


Thanks, Rogério Brito.

P.S.: Can I add my name as one of the developers on the History marking
that I've done some janitorial work and debian packaging? I refrained
myself from doing this because I thought that my contributions to the
project weren't so much...
--
Rogério Brito : rbrito@{mackenzie,ime.usp}.br : GPG key 1024D/7C2CAEB8
http://www.ime.usp.br/~rbrito : http://meusite.mackenzie.com.br/rbrito
Projects: algorithms.berlios.de : lame.sf.net : vrms.alioth.debian.org

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Lame-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/lame-dev
Alexander Leidinger

Re: Doing some janitorial work (a bit long)

Reply Threaded More More options
Print post
Permalink
Quoting Rogério Brito <[hidden email]> (from Tue, 10 Jun 2008  
15:53:34 -0300):

[abx]
> Alexander, could you test it under FreeBSD to see if it is too much
> system dependent? I don't know how much the sound system of FreeBSD
> differs from Linux, but I'm only using the basic Open Sound System at
> this time (no ALSA etc---which is Linux only, I think).

We also have an OSS compatible system. The important difference to  
linux is, that some IOCTLs are picky about te order in which they are  
issued. I try to get some time to test this. If you don't hear from  
me, nag me about it again.

> P.S.: Can I add my name as one of the developers on the History marking
> that I've done some janitorial work and debian packaging? I refrained
> myself from doing this because I thought that my contributions to the
> project weren't so much...

You changed code, you have a commit bit, go ahead.

Bye,
Alexander.

--
A new koan:
        If you have some ice cream, I will give it to you.
        If you have no ice cream, I will take it away from you.
It is an ice cream koan.

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Lame-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/lame-dev
Alexander Leidinger

Re: Doing some janitorial work (a bit long)

Reply Threaded More More options
Print post
Permalink
In reply to this post by Rogério Brito-2
Quoting Rogério Brito <[hidden email]> (from Tue, 10 Jun 2008  
15:53:34 -0300):

> BTW, what is a portable way of swapping the bytes of a int16_t or of a
> int32_t? I can write macros for that (they are actually quite easy) or,
> better yet, some inline functions, but I don't want to reinvent the
> wheel when better, portable ways exist. (I'm mostly concerned with
> portability).

Ah... I forgot to answer this:

man htonl/htons/ntohl/ntohs

What you will see there are network related functions. They convert  
from/to host byte order (little or big) to/from network byte order  
(big endian). If the host is already big endian, then this is a nop,  
off course. Those are the only standardized (POSIX) functions I know  
about in this area. If they don't fit your needs, you have to write  
your own ones.

Bye,
Alexander.

--
TACKY:
        Serving grape Kool-Aid at religious functions.

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Lame-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/lame-dev
Rogério Brito-2

Re: Doing some janitorial work (a bit long)

Reply Threaded More More options
Print post
Permalink
In reply to this post by Alexander Leidinger
On Jun 11 2008, Alexander Leidinger wrote:

> Quoting Rogério Brito <[hidden email]> (from Tue, 10 Jun 2008  
> 15:53:34 -0300):
>
> [abx]
>> Alexander, could you test it under FreeBSD to see if it is too much
>> system dependent? I don't know how much the sound system of FreeBSD
>> differs from Linux, but I'm only using the basic Open Sound System at
>> this time (no ALSA etc---which is Linux only, I think).
>
> We also have an OSS compatible system. The important difference to linux
> is, that some IOCTLs are picky about te order in which they are issued. I
> try to get some time to test this. If you don't hear from me, nag me
> about it again.

Could you please test this code to see if the order of the ioctls is
right for FreeBSD? Just put a wav file (44.1kHz, stereo, little-endian)
named sai.wav on the same directory where you compile this and tell me
if it plays the file.

It was just a quick and dirty work, but I think that it would be a good
preliminary test.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/soundcard.h>

int main(void)
{
  int fd, i;
  int wav;
  int buff[44100*2*2]; /* one sec */

  fd = open("/dev/dsp", O_WRONLY);
  if (fd == -1) {fprintf(stderr, "Fodeu abertura\n"); exit(1);}

  ioctl(fd, SNDCTL_DSP_RESET, 0);

  i = 1;
  ioctl(fd, SNDCTL_DSP_STEREO, &i);
  printf("%d\n", i);

  i = 44100;
  ioctl(fd, SNDCTL_DSP_SPEED, &i);
  printf("%d\n", i);

  i = AFMT_S16_LE;
  printf("%x\n", i);
  if (ioctl(fd, SNDCTL_DSP_SETFMT, &i) == -1) {fprintf(stdout, "prob\n");}
  printf("%x\n", i);

  wav = open("sai.wav", O_RDONLY);
  if (wav == -1)
          exit(1);

  read(wav, buff, 44); /* discard wav header */
  while (read(wav, buff, 44100*2*2)) {
          write(fd, buff, 44100*2*2);
  }

  if (close(fd) == -1) {fprintf(stderr, "Fodeu fechamento\n"); exit(2);}
  if (close(wav) == -1) {fprintf(stderr, "Fodeu fechamento wav\n"); exit(3);}
  return 0;
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

>> P.S.: Can I add my name as one of the developers on the History marking
>> that I've done some janitorial work and debian packaging? I refrained
>> myself from doing this because I thought that my contributions to the
>> project weren't so much...
>
> You changed code, you have a commit bit, go ahead.

Nice. Thanks.


Regards, Rogério Brito.

--
Rogério Brito : rbrito@{mackenzie,ime.usp}.br : GPG key 1024D/7C2CAEB8
http://www.ime.usp.br/~rbrito : http://meusite.mackenzie.com.br/rbrito
Projects: algorithms.berlios.de : lame.sf.net : vrms.alioth.debian.org

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Lame-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/lame-dev