diff mbox series

[FFmpeg-devel,1/2] avcodec/adpcm_ima_{apc, ssi, oki}: replace while() with for()

Message ID 20200418005911.22975-1-zane@zanevaniperen.com
State Accepted
Commit 7150123aab0f3861208a6b7278b90c29d4b83298
Headers show
Series [FFmpeg-devel,1/2] avcodec/adpcm_ima_{apc, ssi, oki}: replace while() with for()
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Zane van Iperen April 18, 2020, 12:59 a.m. UTC
Per discussion at https://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/260854.html

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
---
 libavcodec/adpcm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Zane van Iperen April 19, 2020, 1:07 p.m. UTC | #1
On Sat, 18 Apr 2020 00:59:25 +0000
"Zane van Iperen" <zane@zanevaniperen.com> wrote:

> Per discussion at
> https://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/260854.html
> 
> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
> ---
>  libavcodec/adpcm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>

Ping.

Zane
Michael Niedermayer April 20, 2020, 6:15 p.m. UTC | #2
On Sat, Apr 18, 2020 at 12:59:25AM +0000, Zane van Iperen wrote:
> Per discussion at https://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/260854.html
> 
> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
> ---
>  libavcodec/adpcm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index ee18875579..7d35884056 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -1271,14 +1271,14 @@  static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
         }
         break;
     case AV_CODEC_ID_ADPCM_IMA_APC:
-        while (bytestream2_get_bytes_left(&gb) > 0) {
+        for (n = nb_samples >> (1 - st); n > 0; n--) {
             int v = bytestream2_get_byteu(&gb);
             *samples++ = adpcm_ima_expand_nibble(&c->status[0],  v >> 4  , 3);
             *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3);
         }
         break;
     case AV_CODEC_ID_ADPCM_IMA_SSI:
-        while (bytestream2_get_bytes_left(&gb) > 0) {
+        for (n = nb_samples >> (1 - st); n > 0; n--) {
             int v = bytestream2_get_byteu(&gb);
             *samples++ = adpcm_ima_qt_expand_nibble(&c->status[0],  v >> 4  );
             *samples++ = adpcm_ima_qt_expand_nibble(&c->status[st], v & 0x0F);
@@ -1305,7 +1305,7 @@  static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
         }
         break;
     case AV_CODEC_ID_ADPCM_IMA_OKI:
-        while (bytestream2_get_bytes_left(&gb) > 0) {
+        for (n = nb_samples >> (1 - st); n > 0; n--) {
             int v = bytestream2_get_byteu(&gb);
             *samples++ = adpcm_ima_oki_expand_nibble(&c->status[0],  v >> 4  );
             *samples++ = adpcm_ima_oki_expand_nibble(&c->status[st], v & 0x0F);