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

Justin Ruggles jruggle
Sun Apr 2 23:27:46 CEST 2006

Michael Niedermayer wrote:
> Hi
> On Sun, Apr 02, 2006 at 01:00:51PM -0400, Justin Ruggles wrote:
>>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
> [...]

Your solution does work better.
How does this patch look?

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ac3enc-framesize-2.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060402/4af44c27/attachment.asc>

More information about the ffmpeg-devel mailing list