]> git.sesse.net Git - ffmpeg/commit
avcodec/ac3enc: Simplify AC-3 bit counting
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Thu, 1 Apr 2021 14:47:11 +0000 (16:47 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Fri, 2 Apr 2021 10:19:07 +0000 (12:19 +0200)
commit18bb323da437642616bfefcc1d6bc781ca0658b4
tree0aee8db7ffd4c0e68f0cffab7c59672e111bccfc
parenteca36784b87be259b89c1d0eecacffac3f672ac6
avcodec/ac3enc: Simplify AC-3 bit counting

When encoding E-AC-3, whether coupling is on or not determines whether
an additional frame based coupling exponent strategy element frmcplexpstr
(of size five bits) is present in the bitstream. So just add five to the
number of bits when counting them instead of adding 5*s->cpl_on (the
latter field is currently only 0 or 1, so it doesn't make a difference).

Furthermore, move some parts of the bit allocation that doesn't change
per-frame to count_frame_bits_fixed() (which is only run once during
init).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
libavcodec/ac3enc.c