[Ffmpeg-cvslog] r5577 - trunk/libavcodec/flacenc.c

Justin Ruggles jruggle
Mon Jul 3 04:41:52 CEST 2006


Michael Niedermayer wrote:
> Hi
> 
> On Sun, Jul 02, 2006 at 06:57:30PM +0100, M?ns Rullg?rd wrote:
> 
>>michael <subversion at mplayerhq.hu> writes:
>>
>>
>>>Author: michael
>>>Date: Sun Jul  2 15:14:04 2006
>>>New Revision: 5577
>>>
>>>Modified:
>>>   trunk/libavcodec/flacenc.c
>>>
>>>Log:
>>>3 lines while -> 1 line for loop 
>>>
>>>Modified: trunk/libavcodec/flacenc.c
>>>==============================================================================
>>>--- trunk/libavcodec/flacenc.c	(original)
>>>+++ trunk/libavcodec/flacenc.c	Sun Jul  2 15:14:04 2006
>>>@@ -788,13 +788,11 @@
>>> {
>>>     int porder, max_parts;
>>>
>>>-    porder = max_porder;
>>>-    while(porder > 0) {
>>>+    for(porder = max_porder; porder > 0; porder--) {
>>>         max_parts = (1 << porder);
>>>         if(!(n % max_parts) && (n > max_parts*order)) {
>>
>>Wouldn't (n & (max_parts - 1)) do the same thing a tad faster?  n is
>>always positive so there should be no surprises.
> 
> 
> yes, and furthermore iam pretty sure the whole can be done without a loop
> something based on av_log2(n ^ (n-1)) or similar
> and iam unsure if n > max_parts*order is correct which was the reason why
> i didnt change anything in that line, i wanted to check that first ...
> 
> 
> [...]

Here is an explanation of (n > max_parts*order)

The size of the first partition is specified as
((block_size/partitions)-order).  This means you need a check to see if
the first partition will have a size <= 0.

As far as doing it without a loop, you may be right, but I can't see how.

-Justin








More information about the ffmpeg-cvslog mailing list