PR #22731 opened by mkver
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22731
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22731.patch


>From d5844408b7da25e3ad5c1b05c7342a77ad96f110 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <[email protected]>
Date: Mon, 6 Apr 2026 19:24:49 +0200
Subject: [PATCH 1/3] avcodec/g726: Fix indentation

Forgotten in e344c1ea36f228e2987e25327638771c4cedcd33.

Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/g726.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libavcodec/g726.c b/libavcodec/g726.c
index f41df3073f..d05b67660d 100644
--- a/libavcodec/g726.c
+++ b/libavcodec/g726.c
@@ -59,12 +59,10 @@ static inline Float11* i2f(int i, Float11* f)
 
 static inline int16_t mult(Float11* f1, Float11* f2)
 {
-        int res, exp;
-
-        exp = f1->exp + f2->exp;
-        res = (((f1->mant * f2->mant) + 0x30) >> 4);
-        res = exp > 19 ? res << (exp - 19) : res >> (19 - exp);
-        return (f1->sign ^ f2->sign) ? -res : res;
+    int exp = f1->exp + f2->exp;
+    int res = (((f1->mant * f2->mant) + 0x30) >> 4);
+    res = exp > 19 ? res << (exp - 19) : res >> (19 - exp);
+    return (f1->sign ^ f2->sign) ? -res : res;
 }
 
 static inline int sgn(int value)
-- 
2.52.0


>From 943da7d59f49eacd528984dfceffe61eaad7b455 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <[email protected]>
Date: Mon, 6 Apr 2026 19:26:07 +0200
Subject: [PATCH 2/3] avcodec/g726: Don't return value from g726_reset()

It always returns zero which none of the callers check,
so just return nothing instead.

Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/g726.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavcodec/g726.c b/libavcodec/g726.c
index d05b67660d..33bab7e06d 100644
--- a/libavcodec/g726.c
+++ b/libavcodec/g726.c
@@ -275,7 +275,7 @@ static int16_t g726_decode(G726Context* c, int I)
     return av_clip(re_signal * 4, -0xffff, 0xffff);
 }
 
-static av_cold int g726_reset(G726Context *c)
+static av_cold void g726_reset(G726Context *c)
 {
     int i;
 
@@ -291,8 +291,6 @@ static av_cold int g726_reset(G726Context *c)
     c->yl = 34816;
 
     c->y = 544;
-
-    return 0;
 }
 
 #if CONFIG_ADPCM_G726_ENCODER || CONFIG_ADPCM_G726LE_ENCODER
-- 
2.52.0


>From 37468ca28542b75bab67eb38737e7613e80048c4 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <[email protected]>
Date: Mon, 6 Apr 2026 19:30:38 +0200
Subject: [PATCH 3/3] avcodec/g726: Remove dead sample rate check

Checked generically since 39206c5e581f5020fe47adf463a759b0f39186d8.

Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/g726.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/libavcodec/g726.c b/libavcodec/g726.c
index 33bab7e06d..d793dec281 100644
--- a/libavcodec/g726.c
+++ b/libavcodec/g726.c
@@ -318,11 +318,6 @@ static av_cold int g726_encode_init(AVCodecContext *avctx)
                "Resample or reduce the compliance level.\n");
         return AVERROR(EINVAL);
     }
-    if (avctx->sample_rate <= 0) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid sample rate %d\n",
-               avctx->sample_rate);
-        return AVERROR(EINVAL);
-    }
 
     if (avctx->ch_layout.nb_channels != 1) {
         av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n");
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to