[FFmpeg-devel] [PATCH 1/2] ac3enc: decrement by 16 instead of 64 in first stage of the CBR bit allocation search.

Justin Ruggles justin.ruggles
Mon Mar 7 16:33:49 CET 2011


On 03/06/2011 03:41 PM, M?ns Rullg?rd wrote:

> Justin Ruggles <justin.ruggles at gmail.com> writes:
> 
>> This speeds up the average search time.
>> ---
>>  libavcodec/ac3enc.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>>
>> diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
>> index 676bb5e..beade19 100644
>> --- a/libavcodec/ac3enc.c
>> +++ b/libavcodec/ac3enc.c
>> @@ -957,7 +957,7 @@ static int cbr_bit_allocation(AC3EncodeContext *s)
>>  
>>      while (snr_offset >= 0 &&
>>             bit_alloc(s, snr_offset) > bits_left) {
>> -        snr_offset -= 64;
>> +        snr_offset -= 16;
>>      }
>>      if (snr_offset < 0)
>>          return AVERROR(EINVAL);
> 
> If you say so... OK.


Below is a link to a graph showing an example distribution of the
difference in snr offset between adjacent frames across an encoded file.
 An increment of 64 is obviously way too high.

http://www.flickr.com/photos/justinruggles/5506495682/sizes/l/in/photostream/

-Justin



More information about the ffmpeg-devel mailing list