[FFmpeg-devel] [PATCH] ac3enc: add num_rematrixing_bands to AC3EncodeContext and use it instead of the hardcoded value.

Reimar Döffinger Reimar.Doeffinger
Sat Mar 5 12:24:26 CET 2011


On Fri, Mar 04, 2011 at 04:47:14PM -0500, Justin Ruggles wrote:
> 
> Currently it is always 4, but this change will allow it to be adjusted when
> bandwidth-related features are added such as channel coupling, enhanced
> channel coupling, and spectral extension.

Did you benchmark? If the compiler could do loop unrolling before it
might be significant.

> @@ -1304,7 +1307,7 @@ static void output_audio_block(AC3EncodeContext *s, int blk)
>          put_bits(&s->pb, 1, block->new_rematrixing_strategy);
>          if (block->new_rematrixing_strategy) {
>              /* rematrixing flags */
> -            for (rbnd = 0; rbnd < 4; rbnd++)
> +            for (rbnd = 0; rbnd < s->num_rematrixing_bands; rbnd++)
>                  put_bits(&s->pb, 1, block->rematrixing_flags[rbnd]);

Also it seems a bad idea to me to replace the constant 4 in the loop
bounds while not doing so in the rematrixing_flags declaration.
E.g. an assert that s->num_rematrixing_bands is not larger than
the rematrixing_flags size might make sense to add somewhere.



More information about the ffmpeg-devel mailing list