* [FFmpeg-devel] [PATCH 06/22] avcodec/ac3enc: Remove use of av_uninit
@ 2025-04-11 7:58 Zhao Zhili
0 siblings, 0 replies; only message in thread
From: Zhao Zhili @ 2025-04-11 7:58 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
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".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-04-11 7:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-11 7:58 [FFmpeg-devel] [PATCH 06/22] avcodec/ac3enc: Remove use of av_uninit Zhao Zhili
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