[FFmpeg-devel] [PATCH 3/4] avcodec/[e]ac3enc: Fix indentation

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Apr 1 18:53:55 EEST 2021


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
Will apply patches 1-4 tomorrow unless there are objections.

 libavcodec/ac3enc.c  | 37 +++++++++++++++++++------------------
 libavcodec/eac3enc.c | 16 ++++++++--------
 2 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index fc4d45651d..e27858e1b0 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -1281,8 +1281,9 @@ static void quantize_mantissas_blk_ch(AC3Mant *s, int32_t *fixed_coef,
         int c = fixed_coef[i];
         int e = exp[i];
         int v = bap[i];
-        if (v)
         switch (v) {
+        case 0:
+            break;
         case 1:
             v = sym_quant(c, e, 3);
             switch (s->mant1_cnt) {
@@ -1439,8 +1440,8 @@ static void ac3_output_frame_header(AC3EncodeContext *s)
             put_bits(&s->pb, 9, 0);     /* xbsi2 and encinfo : reserved */
         }
     } else {
-    put_bits(&s->pb, 1, 0);         /* no time code 1 */
-    put_bits(&s->pb, 1, 0);         /* no time code 2 */
+        put_bits(&s->pb, 1, 0);     /* no time code 1 */
+        put_bits(&s->pb, 1, 0);     /* no time code 2 */
     }
     put_bits(&s->pb, 1, 0);         /* no additional bit stream info */
 }
@@ -1697,16 +1698,16 @@ static void output_frame_end(AC3EncodeContext *s)
         /* compute crc2 */
         crc2_partial = av_crc(crc_ctx, 0, frame + 2, s->frame_size - 5);
     } else {
-    /* compute crc1 */
-    /* this is not so easy because it is at the beginning of the data... */
-    crc1    = av_bswap16(av_crc(crc_ctx, 0, frame + 4, frame_size_58 - 4));
-    crc_inv = s->crc_inv[s->frame_size > s->frame_size_min];
-    crc1    = mul_poly(crc_inv, crc1, CRC16_POLY);
-    AV_WB16(frame + 2, crc1);
+        /* compute crc1 */
+        /* this is not so easy because it is at the beginning of the data... */
+        crc1    = av_bswap16(av_crc(crc_ctx, 0, frame + 4, frame_size_58 - 4));
+        crc_inv = s->crc_inv[s->frame_size > s->frame_size_min];
+        crc1    = mul_poly(crc_inv, crc1, CRC16_POLY);
+        AV_WB16(frame + 2, crc1);
 
-    /* compute crc2 */
-    crc2_partial = av_crc(crc_ctx, 0, frame + frame_size_58,
-                          s->frame_size - frame_size_58 - 3);
+        /* compute crc2 */
+        crc2_partial = av_crc(crc_ctx, 0, frame + frame_size_58,
+                              s->frame_size - frame_size_58 - 3);
     }
     crc2 = av_crc(crc_ctx, crc2_partial, frame + s->frame_size - 3, 1);
     /* ensure crc2 does not match sync word by flipping crcrsv bit if needed */
@@ -1989,13 +1990,13 @@ int ff_ac3_validate_metadata(AC3EncodeContext *s)
     if (!s->eac3) {
         if (s->has_center) {
             validate_mix_level(avctx, "center_mix_level", &opt->center_mix_level,
-                            cmixlev_options, CMIXLEV_NUM_OPTIONS, 1, 0,
-                            &s->center_mix_level);
+                               cmixlev_options, CMIXLEV_NUM_OPTIONS, 1, 0,
+                               &s->center_mix_level);
         }
         if (s->has_surround) {
             validate_mix_level(avctx, "surround_mix_level", &opt->surround_mix_level,
-                            surmixlev_options, SURMIXLEV_NUM_OPTIONS, 1, 0,
-                            &s->surround_mix_level);
+                               surmixlev_options, SURMIXLEV_NUM_OPTIONS, 1, 0,
+                               &s->surround_mix_level);
         }
     }
 
@@ -2119,8 +2120,8 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx)
     av_freep(&s->mdct_window);
     av_freep(&s->windowed_samples);
     if (s->planar_samples)
-    for (ch = 0; ch < s->channels; ch++)
-        av_freep(&s->planar_samples[ch]);
+        for (ch = 0; ch < s->channels; ch++)
+            av_freep(&s->planar_samples[ch]);
     av_freep(&s->planar_samples);
     av_freep(&s->bap_buffer);
     av_freep(&s->bap1_buffer);
diff --git a/libavcodec/eac3enc.c b/libavcodec/eac3enc.c
index 356bb677c2..06d4df8f56 100644
--- a/libavcodec/eac3enc.c
+++ b/libavcodec/eac3enc.c
@@ -193,8 +193,8 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s)
 
     /* frame header */
     if (s->num_blocks == 6) {
-    put_bits(&s->pb, 1, !s->use_frame_exp_strategy);/* exponent strategy syntax */
-    put_bits(&s->pb, 1, 0);                         /* aht enabled = no */
+        put_bits(&s->pb, 1, !s->use_frame_exp_strategy); /* exponent strategy syntax */
+        put_bits(&s->pb, 1, 0);                     /* aht enabled = no */
     }
     put_bits(&s->pb, 2, 0);                         /* snr offset strategy = 1 */
     put_bits(&s->pb, 1, 0);                         /* transient pre-noise processing enabled = no */
@@ -232,12 +232,12 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s)
     if (s->num_blocks != 6) {
         put_bits(&s->pb, 1, 0);
     } else {
-    for (ch = 1; ch <= s->fbw_channels; ch++) {
-        if (s->use_frame_exp_strategy)
-            put_bits(&s->pb, 5, s->frame_exp_strategy[ch]);
-        else
-            put_bits(&s->pb, 5, 0);
-    }
+        for (ch = 1; ch <= s->fbw_channels; ch++) {
+            if (s->use_frame_exp_strategy)
+                put_bits(&s->pb, 5, s->frame_exp_strategy[ch]);
+            else
+                put_bits(&s->pb, 5, 0);
+        }
     }
     /* snr offsets */
     put_bits(&s->pb, 6, s->coarse_snr_offset);
-- 
2.27.0



More information about the ffmpeg-devel mailing list