Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: New FLAC encoder (Read 374577 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

New FLAC encoder

Reply #100
I can encode that sample at -0 just fine, using wisodev's Flake 0.10 build, both through Foobar and the commandline.

I did discover another bug: when trying to read from the following filename: "- 37_0-10_12.wav" or when trying to write a file called "- 37_0-10_12.flac" it fails. For the output i get a "tried to write to nonexistent pipe" error and for the input file, it treats it like an unrecognised commandline and gives the standard message. I tested further and it gives the error for all filenames that start with a dash.
Flac handles it fine.

I'll try to fix that very soon.  Flake only has very simple commandline parsing right now.  It should be fairly trivial to fix.
Thanks,
Justin


It seems the problem is still evident even in the first 10 seconds of the file, so I have uploaded a Flake -12 encoded version of the first 10 seconds for others to test:

http://synthetic-soul.co.uk/temp/37_0-10_12.flac


Hmm. It works for me, but I'm using Linux.  The "-0" mode has been changed some since the 0.10 release.  Could you try using current SVN?  If you need a binary, I can compile one & post it.

New FLAC encoder

Reply #101
Mine is failing at home on Win2K with Athlon XP 2400+, and at work with XP.  I believe the CPU at work is AMD.  I will confirm later.

I will see if I can compile from SVN today at work.

Edit: I will only be able to compile if there are Visual C++ project files, as I'm not a C++ programmer, I can just hack some code and click a button to compile.  As you are a Linux man I doubt this will be the case so a binary would be nice if someone could provide.  Edit 2: I do have Cygwin installed, but I'm not sure that I have the necessary parts, and I've never compiled using a makefile!  I see from browsing the repository that there are no Visual C++ project files.

Flake 0.10 has failed to compress your test file with -0 switch on my Pentium 4 PC BUT it succeeded to compress it on my Intel Centrino laptop. Seems like Flake has some issues with Pentium 4?
Thanks for proving I'm not mad anyway!
I'm on a horse.

New FLAC encoder

Reply #102
i think that you can just use make to compile the sources. if you want to do that, just grab a copy of MinGW(there's a nice installer for it too) and use "mingw32-make" on the directory with all of the source code. i just quickly browsed through the SVN and i saw that there was a makefile in there so theoretically, it should work. I'm a bit lazy to try it out though.

edit: btw, flake is really nice. right now, I'm using the -12 option on build 0.10 and it makes smaller files with faster decoding. i tested it with Josh's optimized FLAC build(the one which he uploaded here) and flake still beats it. I've also heard that FLAC 1.1.3 will have some of flake's improvements so i can't wait till FLAC 1.1.3 releases.

edit2: spelling

New FLAC encoder

Reply #103
I've also heard that FLAC 1.1.3 will have some of flake's improvements


Are the two developers in contact and working cooperatively rather than competitively?

New FLAC encoder

Reply #104
i, personally, am not too sure. i've only seen a post in a yalac thread(or something similar) by Josh saying that some of flake's improvements will be in 1.1.3. if you want to know the answer to the question, then i guess you should contact Josh.

New FLAC encoder

Reply #105
Guys, sorry for beeing noob, but could someone of you upload the build for win32 platform using latest SVN, please?

New FLAC encoder

Reply #106
@bukem
I will upload binarys based on SVN sources after I come home from work (around 16.00 CET).

@Synthetic Soul
You can use project files from flake-0.10-win32-wisodev-src.zip at SourceForge. Copy win32 directory to exported SVN sources root directory and build flake project using Debug setting to provide more information on possible crashes.

New FLAC encoder

Reply #107
I appear to have managed to build flake under cygwin.  I had to download autoconf and make but it finally worked (once I worked out gcc didn't like paths with spaces...).

My binary can be found here. Edit: Link updated to bug-free version (see #113)

It appears to work with 37.wav.

@Synthetic Soul
You can use project files from flake-0.10-win32-wisodev-src.zip at SourceForge. Copy win32 directory to exported SVN sources root directory and build flake project using Debug setting to provide more information on possible crashes.
Ah, thanks for that.  I may take a look anyway.

Edit: wisodev.  I'm using Visual C++ 2005 Express Edition and, after I had converted the solution file to the newer format, it complains about the .icproj files... saying the application is not installed...  no idea what it's all about.  I think I've proved for now that the SVN code works with my file, but I will no doubt test again if you release an SVN version.

Justin, out of interest, what is flake_g.exe?  Is it a debug version?  As I said, I'm not used to compiling with make!

i think that you can just use make to compile the sources. if you want to do that, just grab a copy of MinGW(there's a nice installer for it too) and use "mingw32-make" on the directory with all of the source code.
I tried this, but the directory had a configure file which I found out is used with autoconf to create config.mak which is required to build, so I had to go the cygwin route (I think).  Thanks for the info anyway.


Edit 10: Hmm... for some reason my cygwin compile refuses to accept -12 saying 21 is too high.  Using -21 works but I'm yet to check whether it is actually being accepted as 12.  Is this my compile's fault?! 
I'm on a horse.

New FLAC encoder

Reply #108
@wisodev:
thanks

@Synthetic Soul / Justin:
There's problem with your compile of flake or with that particular SVN version. When I try to use preset -12 I get following error:

Code: [Select]
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\documents\music\.work>flake -12 37_0-10_12.wav test.flac

Flake: FLAC audio encoder
(c) 2006  Justin Ruggles

invalid compression: 21. must be 0 to 12.
usage: flake [options] <input.wav> <output.flac>
type 'flake -h' for more details.

It seems that for preset 12 wrong value is hardcoded in the source code -> 21 instead of 12.

New FLAC encoder

Reply #109
@Synthetic Soul
You can use project files from flake-0.10-win32-wisodev-src.zip at SourceForge. Copy win32 directory to exported SVN sources root directory and build flake project using Debug setting to provide more information on possible crashes.
Ah, thanks for that.  I may take a look anyway.

Edit: wisodev.  I'm using Visual C++ 2005 Express Edition and, after I had converted the solution file to the newer format, it complains about the .icproj files... saying the application is not installed...  no idea what it's all about.  I think I've proved for now that the SVN code works with my file, but I will no doubt test again if you release an SVN version.


Oh sorry I am using Intel C++ compile at version 8.0.40 and C99 switch (this is req.) witch means it wan't compile Visual Studio without Intel compiler. And version 8 of Intel C++ compiler do not works with Express edition, maybe version 9 works but it produces for me slower binarys (trail version of compiler available on intel website).

New FLAC encoder

Reply #110
@Synthetic Soul / Justin:
There's problem with your compile of flake or with that particular SVN version. When I try to use preset -12 I get following error:

Code: [Select]
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\documents\music\.work>flake -12 37_0-10_12.wav test.flac

Flake: FLAC audio encoder
(c) 2006  Justin Ruggles

invalid compression: 21. must be 0 to 12.
usage: flake [options] <input.wav> <output.flac>
type 'flake -h' for more details.
Yes, I just noticed this (see edit above)!  Very curious.  I can only assume it is my dodgy compiling though.  I would wait for wisodev's.
I'm on a horse.

New FLAC encoder

Reply #111
there is a small bug in flake.c in the parse_number() subroutine

a quick fix

change

Code: [Select]
  for(i=0; i<max; i++)


to

Code: [Select]
  for(i=max-1; i>=0; i--)


New FLAC encoder

Reply #113
i, personally, am not too sure. i've only seen a post in a yalac thread(or something similar) by Josh saying that some of flake's improvements will be in 1.1.3. if you want to know the answer to the question, then i guess you should contact Josh.

To answer your question, no we are not in direct collaboration.  It's not that I want to be competitive...open source is collaborative by its very nature.  I do want to continue to make Flake faster and better, but I'll also be quite happy if some of the ideas in Flake are used to help improve the reference encoder.
 
@Synthetic Soul / Justin:
There's problem with your compile of flake or with that particular SVN version. When I try to use preset -12 I get following error:

Code: [Select]
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\documents\music\.work>flake -12 37_0-10_12.wav test.flac

Flake: FLAC audio encoder
(c) 2006  Justin Ruggles

invalid compression: 21. must be 0 to 12.
usage: flake [options] <input.wav> <output.flac>
type 'flake -h' for more details.
Yes, I just noticed this (see edit above)! Very curious. I can only assume it is my dodgy compiling though. I would wait for wisodev's.

  It is fixed now in SVN.  And as was just pointed out, it was my dodgy coding, not anyone's dodgy compiling.


there is a small bug in flake.c in the parse_number() subroutine

a quick fix

change

Code: [Select]
  for(i=0; i<max; i++)


to

Code: [Select]
  for(i=max-1; i>=0; i--)

That was the problem, but that solution does not work.  The 'max' parameter is not the actual number of digits, but the maximum number.  If the number of digits is shorter, that code will not work.  I applied a fix which counts the digits first, then works backwards.

New FLAC encoder

Reply #114
Quote
The 'max' parameter is not the actual number of digits, but the maximum number.


the fix was as quick as my thoughts about it, sry!
btw, why do you reinvent the wheel? use atoi()

this also works
Code: [Select]
int ParseNumber(char *arg)
{
  int i;
  int n = 0;
  for(i=0;i<strlen(arg);i++)
  {
    if(arg[i] < '0' || arg[i] > '9') return -1;
    n *= 10;
    n += (arg[i]-48);
  }
  return n;
}

New FLAC encoder

Reply #115
Hey Justin, I was just looking over the code for Levinson-Durbin recursion, and noticed something odd. In it's very signature you have lpc[][], which is declared in lpc_calc_coefs as lpc[32][32] (I put numbers instead of constant name for readability here), but the algorithm works on the Toeplitz matrix, so storage should be 2N-1. That's a terrible waste of bits, even if it is only a 32x32 array.

what makes even less sense to me is that Levinson algorithm supposed to solve Ax=b for x, given A and b. and that lpc_compute_coefs seems to take 2 vectors and compute the matrix.
The Plan Within Plans

New FLAC encoder

Reply #116
Wll I am bit late but I have tested this wav file witch caused crushes.
I think the s->max_frame_size is estimated incorrectly.

I have patched sources and I think fixed both bugs (crushing and incorrect command-line argument parsing).
My ParseNumber fix is similiar to posted here.

Download patched sources:
flake-svn-2006-09-19-patched-win32-src.zip
Download patched binarys:
flake-svn-2006-09-19-patched-win32-bin.zip

wiso

New FLAC encoder

Reply #117
Thanks for the non-cygwin-reliant compile wisodev.

I must admit that I am a little confused about the s->max_frame_size bug.

The version I compiled from the SVN source worked fine with my troublesome 37.wav.

Are you saying that, even so, there was still a bug present that could reproduce the behaviour I had seen?
I'm on a horse.

New FLAC encoder

Reply #118
Thanks for the non-cygwin-reliant compile wisodev.

I must admit that I am a little confused about the s->max_frame_size bug.

The version I compiled from the SVN source worked fine with my troublesome 37.wav.

Are you saying that, even so, there was still a bug present that could reproduce the behaviour I had seen?


No problem.

- Well I tested the sources (before ParseNumber fix) and this bug was present. The free(frame) in main.c  was causing this crush.
- When I changed max frame bufer to bigger value (added 4 bytes) then it was all OK.
- I have checked older sources (07 version of flake) and the estimation of max frame buffer (encode.c) was changed since them. So I have patched the svn sources and the bug was gone.
- Please try this flake-svn-2006-09-19-win32-bin.zip binary because it is causing flake to crush with 37.wav file and setting -0.

This becomes little complicated. Maybe Justin can put more light on this bug.

New FLAC encoder

Reply #119
Thanx wisodev for non-cygwin version! And thank you Synthetic Soul for a cygwin one

New FLAC encoder

Reply #120
I've also heard that FLAC 1.1.3 will have some of flake's improvements

Are the two developers in contact and working cooperatively rather than competitively?

it's not competitive.  it's good to have independent (compliant) implementations.  flake code is simpler and encodes faster, but has less features.

the improvement is in how the signal is windowed before lpc analysis.  we were both working on this at the same time but flake has a shorter release cycle.  the method in the upcoming version of FLAC is slower but gives slightly more compression.

Hey Justin, I was just looking over the code for Levinson-Durbin recursion, and noticed something odd. In it's very signature you have lpc[][], which is declared in lpc_calc_coefs as lpc[32][32] (I put numbers instead of constant name for readability here), but the algorithm works on the Toeplitz matrix, so storage should be 2N-1. That's a terrible waste of bits, even if it is only a 32x32 array.

that 32x32 array is for the output coefficients for all orders.  the max order is 32 so you need 32+31+30+...+1 doubles.  there is some waste putting it in a sparse array but not much, and the code is simpler.

what makes even less sense to me is that Levinson algorithm supposed to solve Ax=b for x, given A and b. and that lpc_compute_coefs seems to take 2 vectors and compute the matrix.

it's computing several solutions for several Ax=b, for several x and b, from the same autocorrelation of the original signal.  that's the magic.  see also http://en.wikipedia.org/wiki/Linear_prediction

New FLAC encoder

Reply #121
- Please try this flake-svn-2006-09-19-win32-bin.zip binary because it is causing flake to crush with 37.wav file and setting -0.
I am now at home, on Win 2K AMD XP 2400+.  I have just tried both your compile and the cygwin compile with the full 37.wav and 37_0-10_12.wav.  The cygwin compile is fine, but your compile crashes.

I'm getting really confused now! 
I'm on a horse.


New FLAC encoder

Reply #123
Yes.  The patched version does work fine here.

However, what is still slightly confusing is that my cygwin compile from the SVN works fine, but wisodev's non-patched compile from the SVN does not.

NB: When I posted above I was confused about wisodev's two compiles, but I realised after posting what he was asking.  However, as you can see, I am still confused.  That said, if wisodev's patch means that all new compiles would work then I suppose that should be an end to the confusion... I don't need to worry why my compile works...  I hope.
I'm on a horse.

New FLAC encoder

Reply #124
@wisodev:
another problem found -> "p" switch for padding isn't working at all; it seems that is treated as "s" switch for stereo decorrelation 

Code: [Select]
D:\documents\music\.work>flake -p 256 -12 37_0-10_12.wav test.flac

Flake: FLAC audio encoder
(c) 2006  Justin Ruggles

invalid stereo decorrelation method: 2. must be 0 or 1.
usage: flake [options] <input.wav> <output.flac>
type 'flake -h' for more details.