diff mbox series

[FFmpeg-devel,4/7] avcodec/ac3enc_template: Perform compile-time checks at compile-time

Message ID 20201205203340.19357-4-andreas.rheinhardt@gmail.com
State Accepted
Commit 49a12ac4af32f82643b840c40d2af2f9e2623729
Headers show
Series [FFmpeg-devel,1/7] avcodec/[e]ac3enc: Make encoders init-threadsafe, fix race
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Dec. 5, 2020, 8:33 p.m. UTC
Runtime checks for whether the encoder is fixed-point or not are
unnecessary here as this is a template; furthermore, there is no
fixed-point EAC-3 encoder, so some checks for whether one is in EAC-3
mode can be omitted when doing fixed-point encoding.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/ac3enc_template.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index cbb7f63f79..974a3f9f74 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -97,8 +97,7 @@  static void apply_mdct(AC3EncodeContext *s)
             s->ac3dsp.apply_window_int16(s->windowed_samples, input_samples,
                                          s->mdct_window, AC3_WINDOW_SIZE);
 
-            if (s->fixed_point)
-                block->coeff_shift[ch+1] = normalize_samples(s);
+            block->coeff_shift[ch + 1] = normalize_samples(s);
 #endif
 
             s->mdct.mdct_calcw(&s->mdct, block->mdct_coef[ch+1],
@@ -311,7 +310,7 @@  static void apply_channel_coupling(AC3EncodeContext *s)
         }
     }
 
-    if (CONFIG_EAC3_ENCODER && s->eac3)
+    if (AC3ENC_FLOAT && CONFIG_EAC3_ENCODER && s->eac3)
         ff_eac3_set_cpl_states(s);
 }
 
@@ -383,14 +382,14 @@  int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt,
             return ret;
     }
 
-    if (s->bit_alloc.sr_code == 1 || s->eac3)
+    if (s->bit_alloc.sr_code == 1 || (AC3ENC_FLOAT && s->eac3))
         ff_ac3_adjust_frame_size(s);
 
     copy_input_samples(s, (SampleType **)frame->extended_data);
 
     apply_mdct(s);
 
-    if (s->fixed_point)
+    if (!AC3ENC_FLOAT)
         scale_coefficients(s);
 
     clip_coefficients(&s->adsp, s->blocks[0].mdct_coef[1],
@@ -404,7 +403,7 @@  int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt,
 
     compute_rematrixing_strategy(s);
 
-    if (!s->fixed_point)
+    if (AC3ENC_FLOAT)
         scale_coefficients(s);
 
     ff_ac3_apply_rematrixing(s);