[Ffmpeg-devel] [PATCH] ac3enc fractional frame sizes

Michael Niedermayer michaelni
Sun Apr 2 22:02:36 CEST 2006


Hi

On Sun, Apr 02, 2006 at 01:00:51PM -0400, Justin Ruggles wrote:
> Hello,
> 
> Seeing the recent post regarding AC3 volume and reading that old thread
> brought back some memories.  Looking at those patches I sent, it's no
> wonder nothing got applied...yikes.  I should have just watched the list
> for a while and maybe I wouldn't have tried to submit a huge patch with
> all sorts of unrelated changes.
> 
> So anyway, I decided to look back at the code to see if there is any
> small change I can suggest.  Adding encoding support for fractional
> frame sizes was pretty simple.  So here is my solution.

this will output many packets with frame_size_min then output many with
frame_size_min+1 and its unneccesary complicated

why not:

while(bits_written >= bitrate && samples_read >= sample_rate){
    bits_written -= bitrate;
    samples_read -= sample_rate;
}
frame_size= frame_size_min + (bits_written * sample_rate < samples_read * bit_rate);
bits_written += frame_size;
samples_read += AC3_FRAME_SIZE;

maybe i forgot a *2 somewhere though

[...]

-- 
Michael





More information about the ffmpeg-devel mailing list