Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Zhao Zhili <quinkblack-at-foxmail.com@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Zhao Zhili <zhilizhao@tencent.com>
Subject: [FFmpeg-devel] [PATCH 06/22] avcodec/ac3enc: Remove use of av_uninit
Date: Fri, 11 Apr 2025 15:58:41 +0800
Message-ID: <tencent_EEEA0039686E7EE6ADDE38F9C2E1B774690A@qq.com> (raw)

From: Zhao Zhili <zhilizhao@tencent.com>

---
 libavcodec/ac3enc.c          |  5 +++--
 libavcodec/ac3enc_template.c | 16 ++++++++--------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index 3649289865..17d45097ac 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -1692,7 +1692,7 @@ static void ac3_output_frame_header(AC3EncodeContext *s, PutBitContext *pb)
  */
 static void output_audio_block(AC3EncodeContext *s, PutBitContext *pb, int blk)
 {
-    int ch, i, baie, bnd, got_cpl, av_uninit(ch0);
+    int ch, i, baie, bnd, got_cpl;
     AC3Block *block = &s->blocks[blk];
 
     /* block switching */
@@ -1852,6 +1852,7 @@ static void output_audio_block(AC3EncodeContext *s, PutBitContext *pb, int blk)
     /* mantissas */
     got_cpl = !block->cpl_in_use;
     for (ch = 1; ch <= s->channels; ch++) {
+        int ch0 = 0;
         int b, q;
 
         if (!got_cpl && ch > 1 && block->channel_in_cpl[ch-1]) {
@@ -2341,7 +2342,7 @@ static av_cold int validate_options(AC3EncodeContext *s)
  */
 static av_cold void set_bandwidth(AC3EncodeContext *s)
 {
-    int blk, ch, av_uninit(cpl_start);
+    int blk, ch, cpl_start = 0;
 
     if (s->cutoff) {
         /* calculate bandwidth based on user-specified cutoff frequency */
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index 049666fdca..84887c8079 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -93,7 +93,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
 #else
     int32_t (*fixed_cpl_coords)[AC3_MAX_CHANNELS][16] = cpl_coords;
 #endif
-    int av_uninit(blk), ch, bnd, i, j;
+    int ch, bnd, i, j;
     CoefSumType energy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}};
     int cpl_start, num_cpl_coefs;
 
@@ -109,7 +109,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
     cpl_start     = FFMIN(256, cpl_start + num_cpl_coefs) - num_cpl_coefs;
 
     /* calculate coupling channel from fbw channels */
-    for (blk = 0; blk < s->num_blocks; blk++) {
+    for (int blk = 0; blk < s->num_blocks; blk++) {
         AC3Block *block = &s->blocks[blk];
         CoefType *cpl_coef = &block->mdct_coef[CPL_CH][cpl_start];
         if (!block->cpl_in_use)
@@ -134,7 +134,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
     while (i < s->cpl_end_freq) {
         int band_size = s->cpl_band_sizes[bnd];
         for (ch = CPL_CH; ch <= s->fbw_channels; ch++) {
-            for (blk = 0; blk < s->num_blocks; blk++) {
+            for (int blk = 0; blk < s->num_blocks; blk++) {
                 AC3Block *block = &s->blocks[blk];
                 if (!block->cpl_in_use || (ch > CPL_CH && !block->channel_in_cpl[ch]))
                     continue;
@@ -149,7 +149,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
     }
 
     /* calculate coupling coordinates for all blocks for all channels */
-    for (blk = 0; blk < s->num_blocks; blk++) {
+    for (int blk = 0; blk < s->num_blocks; blk++) {
         AC3Block *block  = &s->blocks[blk];
         if (!block->cpl_in_use)
             continue;
@@ -164,7 +164,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
     }
 
     /* determine which blocks to send new coupling coordinates for */
-    for (blk = 0; blk < s->num_blocks; blk++) {
+    for (int blk = 0; blk < s->num_blocks; blk++) {
         AC3Block *block  = &s->blocks[blk];
         AC3Block *block0 = blk ? &s->blocks[blk-1] : NULL;
 
@@ -205,9 +205,9 @@ static void apply_channel_coupling(AC3EncodeContext *s)
     /* calculate final coupling coordinates, taking into account reusing of
        coordinates in successive blocks */
     for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
-        blk = 0;
+        int blk = 0;
         while (blk < s->num_blocks) {
-            int av_uninit(blk1);
+            int blk1 = 0;
             AC3Block *block  = &s->blocks[blk];
 
             if (!block->cpl_in_use) {
@@ -236,7 +236,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
     }
 
     /* calculate exponents/mantissas for coupling coordinates */
-    for (blk = 0; blk < s->num_blocks; blk++) {
+    for (int blk = 0; blk < s->num_blocks; blk++) {
         AC3Block *block = &s->blocks[blk];
         if (!block->cpl_in_use)
             continue;
-- 
2.46.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

                 reply	other threads:[~2025-04-11  7:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_EEEA0039686E7EE6ADDE38F9C2E1B774690A@qq.com \
    --to=quinkblack-at-foxmail.com@ffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=zhilizhao@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git